summaryrefslogtreecommitdiffstats
path: root/plugins/xenserver
diff options
context:
space:
mode:
authorEd Leafe <ed@leafe.com>2011-08-04 21:17:21 +0000
committerEd Leafe <ed@leafe.com>2011-08-04 21:17:21 +0000
commiteb66810f6034a29724630e89739217a83b858d86 (patch)
tree74a6bc9cfa3dc8988255ff43a7980f1713010123 /plugins/xenserver
parentb5ff9bc2add98444773a26ce37e1ceb82e9531ae (diff)
parentdcac4bc6c7be9832704e37cca7ce815e083974f5 (diff)
downloadnova-eb66810f6034a29724630e89739217a83b858d86.tar.gz
nova-eb66810f6034a29724630e89739217a83b858d86.tar.xz
nova-eb66810f6034a29724630e89739217a83b858d86.zip
Merged in the power action changes
Diffstat (limited to 'plugins/xenserver')
-rwxr-xr-xplugins/xenserver/xenapi/etc/xapi.d/plugins/xenhost13
1 files changed, 7 insertions, 6 deletions
diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenhost b/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenhost
index b48a303ee..a28f5abfb 100755
--- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenhost
+++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenhost
@@ -104,6 +104,7 @@ def set_host_enabled(self, arg_dict):
return {"status": status}
+<<<<<<< TREE
def _write_config_dict(dct):
conf_file = file(config_file_path, "w")
json.dump(dct, conf_file)
@@ -163,7 +164,7 @@ def set_config(self, arg_dict):
_write_config_dict(conf)
-def _powerstate(state):
+def _power_action(action):
host_uuid = _get_host_uuid()
# Host must be disabled first
result = _run_command("xe host-disable")
@@ -175,23 +176,23 @@ def _powerstate(state):
raise pluginlib.PluginError(result)
cmds = {"reboot": "xe host-reboot", "startup": "xe host-power-on",
"shutdown": "xe host-shutdown"}
- result = _run_command(cmds[state])
+ result = _run_command(cmds[action])
# Should be empty string
if result:
raise pluginlib.PluginError(result)
- return {"powerstate": state}
+ return {"power_action": action}
@jsonify
def host_reboot(self, arg_dict):
"""Reboots the host."""
- return _powerstate("reboot")
+ return _power_action("reboot")
@jsonify
def host_shutdown(self, arg_dict):
"""Reboots the host."""
- return _powerstate("shutdown")
+ return _power_action("shutdown")
@jsonify
@@ -199,7 +200,7 @@ def host_start(self, arg_dict):
"""Starts the host. NOTE: Currently not feasible, since the host
runs on the same machine as Xen.
"""
- return _powerstate("startup")
+ return _power_action("startup")
@jsonify