From 2cf8b77c6933a5294c6f75591544651bee36c9a0 Mon Sep 17 00:00:00 2001 From: John Garbutt Date: Thu, 19 Jan 2012 17:04:36 +0000 Subject: blueprint host-aggregates: maintenance operations to host OSAPI exts This commit introduces sub for a host maintenance_mode option into the osapi. It is required for the host aggregates work. This is part of a series of commits that have started with change: https://review.openstack.org/#change,3035 Change-Id: Ib462ef9ad6b641bf1083cc176dfba6645020ccec --- nova/api/openstack/compute/contrib/hosts.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/contrib/hosts.py b/nova/api/openstack/compute/contrib/hosts.py index 66dd64def..726ccb372 100644 --- a/nova/api/openstack/compute/contrib/hosts.py +++ b/nova/api/openstack/compute/contrib/hosts.py @@ -52,6 +52,7 @@ class HostUpdateTemplate(xmlutil.TemplateBuilder): root = xmlutil.TemplateElement('host') root.set('host') root.set('status') + root.set('maintenance_mode') return xmlutil.MasterTemplate(root, 1) @@ -125,15 +126,18 @@ class HostController(object): # settings may follow. if key == "status": if val[:6] in ("enable", "disabl"): - return self._set_enabled_status(req, id, - enabled=(val.startswith("enable"))) + enabled = val.startswith("enable") else: explanation = _("Invalid status: '%s'") % raw_val raise webob.exc.HTTPBadRequest(explanation=explanation) + elif key == "maintenance_mode": + raise webob.exc.HTTPNotImplemented else: explanation = _("Invalid update setting: '%s'") % raw_key raise webob.exc.HTTPBadRequest(explanation=explanation) + return self._set_enabled_status(req, id, enabled=enabled) + def _set_enabled_status(self, req, host, enabled): """Sets the specified host's ability to accept new instances.""" context = req.environ['nova.context'] -- cgit