dom0: fix waiting for vif detach

This commit is contained in:
Marek Marczykowski 2011-09-03 16:01:22 +02:00
parent 73fc87efa2
commit 7f24727b2b

View File

@ -609,10 +609,10 @@ class QubesVm(object):
# Don't check retcode - it always will fail when backend domain is down
subprocess.call(["/usr/sbin/xl",
"network-detach", self.name, m.group(1)], stderr=subprocess.PIPE)
# Wait for device destroy
# Wait for device destroy (in most cases just ensure that device already is removed)
tries = 0
path = "'{0}/device/vif/0/state".format(xs.get_domain_path(self.xid))
while xs.read(path):
path = "{0}/device/vif/0/state".format(xs.get_domain_path(self.xid))
while xs.read('', path) is not None:
time.sleep(0.1)
tries += 1
if tries > 10: