浏览代码

core: ignore error when PCI device already "detached"

This can be the case at startup, when all network devices are connected
to pciback module by initramfs.
Marek Marczykowski-Górecki 10 年之前
父节点
当前提交
7e355c5dad
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      core-modules/000QubesVm.py

+ 8 - 1
core-modules/000QubesVm.py

@@ -1597,7 +1597,14 @@ class QubesVm(object):
         # Bind pci devices to pciback driver
         for pci in self.pcidevs:
             nd = vmm.libvirt_conn.nodeDeviceLookupByName('pci_0000_' + pci.replace(':','_').replace('.','_'))
-            nd.dettach()
+            try:
+                nd.dettach()
+            except libvirt.libvirtError:
+                if libvirt.virGetLastError()[0] == libvirt.VIR_ERR_INTERNAL_ERROR:
+                    # allready detached
+                    pass
+                else:
+                    raise
 
         self.libvirt_domain.createWithFlags(libvirt.VIR_DOMAIN_START_PAUSED)