diff options
| author | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2012-09-26 15:33:52 +0000 |
|---|---|---|
| committer | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2012-09-26 15:42:52 +0000 |
| commit | fe478bd49f031d4f9edaa8def9737af85aef6be6 (patch) | |
| tree | b6600cba9e70a5e64ae7850b02a6738bc4045cec /nova | |
| parent | c367fa5e4a5e4712bde9fc319ae6c2f4f2add606 (diff) | |
| download | nova-fe478bd49f031d4f9edaa8def9737af85aef6be6.tar.gz nova-fe478bd49f031d4f9edaa8def9737af85aef6be6.tar.xz nova-fe478bd49f031d4f9edaa8def9737af85aef6be6.zip | |
xenapi: increase timeout for resetnetwork agent request
Windows can take longer than the default 30 seconds for resetnetwork
requests. Double the timeout for the command to 60 seconds, but add
a flag so it can be changed without code changes in the future.
At the same time, add a flag for all other agent requests too.
Change-Id: Iba91c37fd5596ea0dd63c20f74925972df1ca715
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/virt/xenapi/agent.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/nova/virt/xenapi/agent.py b/nova/virt/xenapi/agent.py index 39705e112..1186692ef 100644 --- a/nova/virt/xenapi/agent.py +++ b/nova/virt/xenapi/agent.py @@ -31,26 +31,37 @@ from nova import utils LOG = logging.getLogger(__name__) xenapi_agent_opts = [ + cfg.IntOpt('agent_timeout', + default=30, + help='number of seconds to wait for agent reply'), cfg.IntOpt('agent_version_timeout', default=300, help='number of seconds to wait for agent ' 'to be fully operational'), + cfg.IntOpt('agent_resetnetwork_timeout', + default=60, + help='number of seconds to wait for agent reply ' + 'to resetnetwork request'), ] FLAGS = flags.FLAGS FLAGS.register_opts(xenapi_agent_opts) -def _call_agent(session, instance, vm_ref, method, addl_args=None): +def _call_agent(session, instance, vm_ref, method, addl_args=None, + timeout=None): """Abstracts out the interaction with the agent xenapi plugin.""" if addl_args is None: addl_args = {} + if timeout is None: + timeout = FLAGS.agent_timeout vm_rec = session.call_xenapi("VM.get_record", vm_ref) args = { 'id': str(uuid.uuid4()), 'dom_id': vm_rec['domid'], + 'timeout': str(timeout), } args.update(addl_args) @@ -204,7 +215,8 @@ def inject_file(session, instance, vm_ref, path, contents): def resetnetwork(session, instance, vm_ref): LOG.debug(_('Resetting network'), instance=instance) - resp = _call_agent(session, instance, vm_ref, 'resetnetwork') + resp = _call_agent(session, instance, vm_ref, 'resetnetwork', + timeout=FLAGS.agent_resetnetwork_timeout) if resp['returncode'] != '0': LOG.error(_('Failed to reset network: %(resp)r'), locals(), instance=instance) |
