diff options
| author | John Garbutt <john.garbutt@citrix.com> | 2012-01-19 17:04:36 +0000 |
|---|---|---|
| committer | Armando Migliaccio <armando.migliaccio@eu.citrix.com> | 2012-01-23 14:37:47 +0000 |
| commit | 2cf8b77c6933a5294c6f75591544651bee36c9a0 (patch) | |
| tree | 48d32f14e136a94c436d6227c3ecb9cd88f8460b /nova/api | |
| parent | c233b8eaafe01cdaabb02a181d73c85a7d37ce17 (diff) | |
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
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/hosts.py | 8 |
1 files changed, 6 insertions, 2 deletions
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'] |
