summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Leafe <ed@leafe.com>2011-07-01 13:44:12 +0000
committerEd Leafe <ed@leafe.com>2011-07-01 13:44:12 +0000
commit7ca20797496947c0bdd60e77b4962fd360e01f55 (patch)
tree58579b2d465e52faf6d8f9aa450fb0d9edb55c03
parentb602ecb52130f9585a5c49217d259a4e3d24fda8 (diff)
after trunk merge
-rw-r--r--nova/api/openstack/auth.py1
-rw-r--r--nova/api/openstack/wsgi.py1
-rw-r--r--nova/compute/api.py10
-rw-r--r--nova/compute/manager.py10
-rw-r--r--nova/scheduler/api.py5
-rw-r--r--nova/scheduler/manager.py4
-rw-r--r--nova/scheduler/zone_manager.py15
7 files changed, 45 insertions, 1 deletions
diff --git a/nova/api/openstack/auth.py b/nova/api/openstack/auth.py
index 7c3e683d6..6231216c9 100644
--- a/nova/api/openstack/auth.py
+++ b/nova/api/openstack/auth.py
@@ -100,6 +100,7 @@ class AuthMiddleware(wsgi.Middleware):
token, user = self._authorize_user(username, key, req)
if user and token:
+ print "TOKEN:", token['token_hash']
res = webob.Response()
res.headers['X-Auth-Token'] = token['token_hash']
res.headers['X-Server-Management-Url'] = \
diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py
index 5b6e3cb1d..ba8ee8bfd 100644
--- a/nova/api/openstack/wsgi.py
+++ b/nova/api/openstack/wsgi.py
@@ -362,6 +362,7 @@ class Resource(wsgi.Application):
"url": request.url})
try:
+ print "BODY: >%s<"%request.body
action, action_args, accept = self.deserializer.deserialize(
request)
except exception.InvalidContentType:
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 28459dc75..4dba6cf1f 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -912,6 +912,16 @@ class API(base.Base):
"""Unpause the given instance."""
self._cast_compute_message('unpause_instance', context, instance_id)
+ def disable_host(self, context, instance_id=None, host=None):
+ """Sets the specified to not receive new instances."""
+ return self._call_compute_message("disable_host", context,
+ instance_id=None, host=host)
+
+ def enable_host(self, context, instance_id=None, host=None):
+ """Sets the specified to receive new instances."""
+ return self._call_compute_message("enable_host", context,
+ instance_id=None, host=host)
+
@scheduler_api.reroute_compute("diagnostics")
def get_diagnostics(self, context, instance_id):
"""Retrieve diagnostics for the given instance."""
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index bbbddde0a..152b2670c 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -875,6 +875,16 @@ class ComputeManager(manager.SchedulerDependentManager):
result))
@exception.wrap_exception
+ def disable_host(self, context, instance_id=None, host=None):
+ """Set a host so that it can not accept new instances."""
+ return self.driver.disable_host(host)
+
+ @exception.wrap_exception
+ def enable_host(self, context, instance_id=None, host=None):
+ """Set a host so that it can accept new instances."""
+ return self.driver.enable_host(host)
+
+ @exception.wrap_exception
def get_diagnostics(self, context, instance_id):
"""Retrieve diagnostics for an instance on this host."""
instance_ref = self.db.instance_get(context, instance_id)
diff --git a/nova/scheduler/api.py b/nova/scheduler/api.py
index 0f4fc48c8..137b671c0 100644
--- a/nova/scheduler/api.py
+++ b/nova/scheduler/api.py
@@ -51,6 +51,11 @@ def _call_scheduler(method, context, params=None):
return rpc.call(context, queue, kwargs)
+def get_host_list(context):
+ """Return a list of hosts associated with this zone."""
+ return _call_scheduler('get_host_list', context)
+
+
def get_zone_list(context):
"""Return a list of zones assoicated with this zone."""
items = _call_scheduler('get_zone_list', context)
diff --git a/nova/scheduler/manager.py b/nova/scheduler/manager.py
index 6cb75aa8d..749d66cad 100644
--- a/nova/scheduler/manager.py
+++ b/nova/scheduler/manager.py
@@ -56,6 +56,10 @@ class SchedulerManager(manager.Manager):
"""Poll child zones periodically to get status."""
self.zone_manager.ping(context)
+ def get_host_list(self, context=None):
+ """Get a list of hosts from the ZoneManager."""
+ return self.zone_manager.get_host_list()
+
def get_zone_list(self, context=None):
"""Get a list of zones from the ZoneManager."""
return self.zone_manager.get_zone_list()
diff --git a/nova/scheduler/zone_manager.py b/nova/scheduler/zone_manager.py
index ba7403c15..169a96989 100644
--- a/nova/scheduler/zone_manager.py
+++ b/nova/scheduler/zone_manager.py
@@ -115,6 +115,17 @@ class ZoneManager(object):
"""Return the list of zones we know about."""
return [zone.to_dict() for zone in self.zone_states.values()]
+ def get_host_list(self):
+ """Returns a list of all the host names that the Zone Manager
+ knows about.
+ """
+ all_hosts = self.service_states.keys()
+ ret = []
+ for host in self.service_states:
+ for svc in self.service_states[host]:
+ ret.append({"service": svc, "host_name": host})
+ return ret
+
def get_zone_capabilities(self, context):
"""Roll up all the individual host info to generic 'service'
capabilities. Each capability is aggregated into
@@ -127,13 +138,15 @@ class ZoneManager(object):
combined = {} # { <service>_<cap> : (min, max), ... }
for host, host_dict in hosts_dict.iteritems():
for service_name, service_dict in host_dict.iteritems():
+ if not service_dict.get("enabled", True):
+ # Service is disabled; do no include it
+ continue
for cap, value in service_dict.iteritems():
key = "%s_%s" % (service_name, cap)
min_value, max_value = combined.get(key, (value, value))
min_value = min(min_value, value)
max_value = max(max_value, value)
combined[key] = (min_value, max_value)
-
return combined
def _refresh_from_db(self, context):