dom0: when cleaning up network devices, wait for actual device destroy

Otherwise subsequent network-attach will not be noticed by frontend driver.
This commit is contained in:
Marek Marczykowski 2011-09-01 00:01:53 +02:00
parent 951b2b0b69
commit 577dd2b076

View File

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