From ee1accfe0328c648344cc59b7b54302ba9a687f0 Mon Sep 17 00:00:00 2001 From: Chris Behrens Date: Sat, 22 Jun 2013 23:07:33 +0000 Subject: Fix xenstore-rm race condition If an entry is already gone from xenstore, any other xenstore-rm will raise. When we make calls to nova-agent, we wait for the response in Xenstore. After a timeout period, we attempt to remove it. If the DomID has changed (due to a Windows VM rebooting at the right time via sysprep, etc)... or if the agent picked up the command and didn't respond in a timely fashion, the removal attempt will fail. It would be normal for the entry to be gone in this case. This fixes the plugin to ignore when the entry is already deleted. Fixes bug 1193720 Change-Id: I8585a9f147cad3c5abe531620872b475eb4128c9 --- plugins/xenserver/xenapi/etc/xapi.d/plugins/xenstore.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenstore.py b/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenstore.py index 9c86b7cb7..a12704248 100755 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenstore.py +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenstore.py @@ -159,7 +159,13 @@ def delete_record(self, arg_dict): VM and the specified path from xenstore. """ cmd = ["xenstore-rm", "/local/domain/%(dom_id)s/%(path)s" % arg_dict] - ret, result = _run_command(cmd) + try: + ret, result = _run_command(cmd) + except XenstoreError, e: + if 'could not remove path' in e.stderr: + # Entry already gone. We're good to go. + return '' + raise return result -- cgit