diff options
| author | Ed Leafe <ed@leafe.com> | 2011-07-07 15:24:12 +0000 |
|---|---|---|
| committer | Ed Leafe <ed@leafe.com> | 2011-07-07 15:24:12 +0000 |
| commit | 6b83e1cd31f5e138af20fbd5c118d55da092eb35 (patch) | |
| tree | e58c899c777f117a9c1415720f87973610b45502 /nova/compute | |
| parent | 9d29dc60d904f2c5037d03cead71933dc62777ff (diff) | |
Added API and supporting code for rebooting or shutting down XenServer hosts.
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/api.py | 6 | ||||
| -rw-r--r-- | nova/compute/manager.py | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index b0eedcd64..71e11c5ea 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -917,6 +917,12 @@ class API(base.Base): return self._call_compute_message("set_host_enabled", context, instance_id=None, host=host, params={"enabled": enabled}) + def set_power_state(self, context, host, power_state): + """Turns the specified host on/off, or reboots the host.""" + return self._call_compute_message("set_power_state", context, + instance_id=None, host=host, + params={"power_state": power_state}) + @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 91a604934..eb8e4df3c 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -881,6 +881,12 @@ class ComputeManager(manager.SchedulerDependentManager): return self.driver.set_host_enabled(host, enabled) @exception.wrap_exception + def set_power_state(self, context, instance_id=None, host=None, + power_state=None): + """Turns the specified host on/off, or reboots the host.""" + return self.driver.set_power_state(host, power_state) + + @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) |
