From ad89c8f8a282d339b270923dc5fabeeba73e6b91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 27 Jun 2015 04:52:25 +0200 Subject: [PATCH] core: show clear message when a VM has non-existing PCI device assigned --- core-modules/000QubesVm.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core-modules/000QubesVm.py b/core-modules/000QubesVm.py index 41c2aed4..18f8813b 100644 --- a/core-modules/000QubesVm.py +++ b/core-modules/000QubesVm.py @@ -1720,7 +1720,15 @@ class QubesVm(object): # Bind pci devices to pciback driver for pci in self.pcidevs: - nd = vmm.libvirt_conn.nodeDeviceLookupByName('pci_0000_' + pci.replace(':','_').replace('.','_')) + try: + nd = vmm.libvirt_conn.nodeDeviceLookupByName('pci_0000_' + pci.replace(':','_').replace('.','_')) + except libvirt.libvirtError as e: + if e.err[0] == libvirt.VIR_ERR_NO_NODE_DEVICE: + raise QubesException( + "PCI device {} does not exist (domain {})". + format(pci, self.name)) + else: + raise try: nd.dettach() except libvirt.libvirtError as e: