diff options
| author | Brian Waldon <brian.waldon@rackspace.com> | 2011-06-22 18:12:53 -0400 |
|---|---|---|
| committer | Brian Waldon <brian.waldon@rackspace.com> | 2011-06-22 18:12:53 -0400 |
| commit | 91c6d50d5945b8f471b2fad753009f8147588c0d (patch) | |
| tree | aa67f03b12139f60641a2fc5996a6201986e142c /plugins | |
| parent | 1f9cd3e7c97034408b5afe3fc3720c48040dea97 (diff) | |
| parent | 7cb4d3150bf0883944624d46bc458cfd25fa1c9a (diff) | |
| download | nova-91c6d50d5945b8f471b2fad753009f8147588c0d.tar.gz nova-91c6d50d5945b8f471b2fad753009f8147588c0d.tar.xz nova-91c6d50d5945b8f471b2fad753009f8147588c0d.zip | |
merging trunk
Diffstat (limited to 'plugins')
| -rwxr-xr-x | plugins/xenserver/xenapi/etc/xapi.d/plugins/agent | 36 | ||||
| -rw-r--r-- | plugins/xenserver/xenapi/etc/xapi.d/plugins/migration | 2 |
2 files changed, 35 insertions, 3 deletions
diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent b/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent index 9e761f264..b8a1b936a 100755 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent @@ -53,6 +53,19 @@ class TimeoutError(StandardError): pass +def version(self, arg_dict): + """Get version of agent.""" + arg_dict["value"] = json.dumps({"name": "version", "value": ""}) + request_id = arg_dict["id"] + arg_dict["path"] = "data/host/%s" % request_id + xenstore.write_record(self, arg_dict) + try: + resp = _wait_for_agent(self, request_id, arg_dict) + except TimeoutError, e: + raise PluginError(e) + return resp + + def key_init(self, arg_dict): """Handles the Diffie-Hellman key exchange with the agent to establish the shared secret key used to encrypt/decrypt sensitive @@ -144,6 +157,23 @@ def inject_file(self, arg_dict): return resp +def agent_update(self, arg_dict): + """Expects an URL and md5sum of the contents, then directs the agent to + update itself.""" + request_id = arg_dict["id"] + url = arg_dict["url"] + md5sum = arg_dict["md5sum"] + arg_dict["value"] = json.dumps({"name": "agentupdate", + "value": {"url": url, "md5sum": md5sum}}) + arg_dict["path"] = "data/host/%s" % request_id + xenstore.write_record(self, arg_dict) + try: + resp = _wait_for_agent(self, request_id, arg_dict) + except TimeoutError, e: + raise PluginError(e) + return resp + + def _agent_has_method(self, method): """Check that the agent has a particular method by checking its features. Cache the features so we don't have to query the agent @@ -201,7 +231,9 @@ def _wait_for_agent(self, request_id, arg_dict): if __name__ == "__main__": XenAPIPlugin.dispatch( - {"key_init": key_init, + {"version": version, + "key_init": key_init, "password": password, "resetnetwork": resetnetwork, - "inject_file": inject_file}) + "inject_file": inject_file, + "agentupdate": agent_update}) diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/migration b/plugins/xenserver/xenapi/etc/xapi.d/plugins/migration index 75c653408..ac1c50ad9 100644 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/migration +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/migration @@ -44,7 +44,7 @@ def move_vhds_into_sr(session, args): new_cow_uuid = params['new_cow_uuid'] sr_path = params['sr_path'] - sr_temp_path = "%s/images/" % sr_path + sr_temp_path = "%s/tmp/" % sr_path # Discover the copied VHDs locally, and then set up paths to copy # them to under the SR |
