diff options
| author | Ed Leafe <ed@leafe.com> | 2011-08-08 14:19:53 +0000 |
|---|---|---|
| committer | Ed Leafe <ed@leafe.com> | 2011-08-08 14:19:53 +0000 |
| commit | b1a503053cb8cbeb1a4ab18e650b49cc4da15e23 (patch) | |
| tree | 7609d01cd6095dd6a33ee2714f1c7277efd1ee14 /nova/api | |
| parent | 10ab2e76b1ea8bbbb6bff4ccaf506bfdd5b57388 (diff) | |
Moved the restriction on host startup to the xenapi layer.:
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/contrib/hosts.py | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/nova/api/openstack/contrib/hosts.py b/nova/api/openstack/contrib/hosts.py index cdf8760d5..d5bd3166b 100644 --- a/nova/api/openstack/contrib/hosts.py +++ b/nova/api/openstack/contrib/hosts.py @@ -96,21 +96,17 @@ class HostController(object): return {"host": host, "status": result} def _host_power_action(self, req, host, action): - """Reboots or shuts down the host.""" + """Reboots, shuts down or powers up the host.""" context = req.environ['nova.context'] - result = self.compute_api.host_power_action(context, host=host, - action=action) + try: + result = self.compute_api.host_power_action(context, host=host, + action=action) + except NotImplementedError as e: + raise webob.exc.HTTPBadRequest(explanation=e.msg) return {"host": host, "power_action": result} def startup(self, req, id): - """The only valid values for 'action' are 'reboot' or - 'shutdown'. For completeness' sake there is the - 'startup' option to start up a host, but this is not - technically feasible now, as we run the host on the - XenServer box. - """ - msg = _("Host startup on XenServer is not supported.") - raise webob.exc.HTTPBadRequest(explanation=msg) + return self._host_power_action(req, host=id, action="startup") def shutdown(self, req, id): return self._host_power_action(req, host=id, action="shutdown") |
