diff options
| author | Ed Leafe <ed@leafe.com> | 2011-08-02 21:23:35 +0000 |
|---|---|---|
| committer | Ed Leafe <ed@leafe.com> | 2011-08-02 21:23:35 +0000 |
| commit | f81122da314a02a1d68f8bbd01fb96d68df61125 (patch) | |
| tree | 8b042433e368abfba422f6a070e059674319a4be /plugins | |
| parent | f06dee2b82bd658a57736d94974f431976085400 (diff) | |
| parent | 1d3d1d5fb552f2dc80c39ad15d89d59bfc7f873a (diff) | |
| download | nova-f81122da314a02a1d68f8bbd01fb96d68df61125.tar.gz nova-f81122da314a02a1d68f8bbd01fb96d68df61125.tar.xz nova-f81122da314a02a1d68f8bbd01fb96d68df61125.zip | |
Added changes from mini server
Diffstat (limited to 'plugins')
| -rwxr-xr-x | plugins/xenserver/xenapi/etc/xapi.d/plugins/xenhost | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenhost b/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenhost index c29d57717..5169aeb12 100755 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenhost +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenhost @@ -143,6 +143,33 @@ def host_start(self, arg_dict): @jsonify +def set_power_state(self, arg_dict): + """Reboots or powers off this host. Ideally, we would also like to be + able to power *on* a host, but right now this is not technically + feasible. + """ + power_state = arg_dict.get("power_state") + if power_state is None: + raise pluginlib.PluginError( + _("Missing 'power_state' argument to set_power_state")) + # Host must be disabled first +# result = _run_command("xe host-disable") +# if result: +# raise pluginlib.PluginError(result) +# # All running VMs must be shutdown +# result = _run_command("xe vm-shutdown --multiple power-state=running") +# if result: +# raise pluginlib.PluginError(result) +# cmds = {"reboot": "xe host-reboot", "on": "xe host-power-on", +# "off": "xe host-shutdown"} +# result = _run_command(cmds[power_state]) +# # Should be empty string +# if result: +# raise pluginlib.PluginError(result) + return {"power_state": power_state} + + +@jsonify def host_data(self, arg_dict): """Runs the commands on the xenstore host to return the current status information. |
