diff options
| author | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2012-08-07 23:25:57 +0000 |
|---|---|---|
| committer | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2012-08-07 23:25:57 +0000 |
| commit | fbb7944851b249e473dab0b350970a4695b04315 (patch) | |
| tree | 039b65dc02b4970fee562487db61ab5575c251fc /plugins | |
| parent | a418654b070c63c4bed5e3e5523fb947934626f9 (diff) | |
| download | nova-fbb7944851b249e473dab0b350970a4695b04315.tar.gz nova-fbb7944851b249e473dab0b350970a4695b04315.tar.xz nova-fbb7944851b249e473dab0b350970a4695b04315.zip | |
xenapi: reduce polling interval for agent
Communicating with the agent requires polling for a response. The
operation uses xenstore, which is lightweight, yet the interval
in between polls was 3 seconds. This would cause longer than necessary
sleeps when an instance was booting making the overall boot slower.
Change-Id: I560c05887128f1a0e29228e859cca25ded4eceec
Diffstat (limited to 'plugins')
| -rwxr-xr-x | plugins/xenserver/xenapi/etc/xapi.d/plugins/agent | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent b/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent index fa1558bd7..a31097262 100755 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent @@ -206,22 +206,22 @@ def _wait_for_agent(self, request_id, arg_dict): arg_dict["path"] = "data/guest/%s" % request_id arg_dict["ignore_missing_path"] = True start = time.time() - while True: - if time.time() - start > AGENT_TIMEOUT: - # No response within the timeout period; bail out - # First, delete the request record - arg_dict["path"] = "data/host/%s" % request_id - xenstore.delete_record(self, arg_dict) - raise TimeoutError(_("TIMEOUT: No response from agent within" - " %s seconds.") % AGENT_TIMEOUT) + while time.time() - start < AGENT_TIMEOUT: ret = xenstore.read_record(self, arg_dict) # Note: the response for None with be a string that includes # double quotes. if ret != '"None"': # The agent responded return ret - else: - time.sleep(3) + + time.sleep(.5) + + # No response within the timeout period; bail out + # First, delete the request record + arg_dict["path"] = "data/host/%s" % request_id + xenstore.delete_record(self, arg_dict) + raise TimeoutError(_("TIMEOUT: No response from agent within" + " %s seconds.") % AGENT_TIMEOUT) if __name__ == "__main__": |
