diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-08-08 16:24:03 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-08-08 16:24:03 +0000 |
| commit | 0e6ec643c26a7355e4f5e8db7c4fce2786a9f63b (patch) | |
| tree | a0e1b51f9b740752662057ab1f0e400f6753c469 | |
| parent | 22526fe42acadee2129a0ab9940e0795490c51ed (diff) | |
| parent | 31f3383ae4953019267c67e4fbd2214b03bc8da8 (diff) | |
Merge "xenapi: wait for agent resetnetwork response"
| -rw-r--r-- | nova/virt/xenapi/agent.py | 9 | ||||
| -rwxr-xr-x | plugins/xenserver/xenapi/etc/xapi.d/plugins/agent | 12 |
2 files changed, 12 insertions, 9 deletions
diff --git a/nova/virt/xenapi/agent.py b/nova/virt/xenapi/agent.py index 577e6fcf5..7204185c3 100644 --- a/nova/virt/xenapi/agent.py +++ b/nova/virt/xenapi/agent.py @@ -193,8 +193,13 @@ def inject_file(session, instance, vm_ref, path, contents): def resetnetwork(session, instance, vm_ref): - """Calls resetnetwork method in agent.""" - _call_agent(session, instance, vm_ref, 'resetnetwork') + resp = _call_agent(session, instance, vm_ref, 'resetnetwork') + if resp['returncode'] != '0': + LOG.error(_('Failed to reset network: %(resp)r'), locals(), + instance=instance) + return None + + return resp['message'] class SimpleDH(object): diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent b/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent index fa1558bd7..07122ba88 100755 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent @@ -43,12 +43,6 @@ import xenstore AGENT_TIMEOUT = 30 -def jsonify(fnc): - def wrapper(*args, **kwargs): - return json.dumps(fnc(*args, **kwargs)) - return wrapper - - class TimeoutError(StandardError): pass @@ -105,7 +99,6 @@ def password(self, arg_dict): return resp -@jsonify def resetnetwork(self, arg_dict): """Writes a resquest to xenstore that tells the agent to reset networking. @@ -114,6 +107,11 @@ def resetnetwork(self, arg_dict): 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 inject_file(self, arg_dict): |
