From e1da1fb3c1156f245af6f6fc90c1b1ad0ff68cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 14 Apr 2015 23:07:54 +0200 Subject: [PATCH] block: fixes for dom0-backed devices and dead domains --- core/qubesutils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/qubesutils.py b/core/qubesutils.py index 3af24bd7..8e50db8c 100644 --- a/core/qubesutils.py +++ b/core/qubesutils.py @@ -334,6 +334,9 @@ def block_check_attached(qvmc, device): raise QubesException("You need to pass qvmc argument") for vm in qvmc.values(): + if vm.qid == 0: + # Connecting devices to dom0 not supported + continue try: libvirt_domain = vm.libvirt_domain if libvirt_domain: @@ -342,7 +345,7 @@ def block_check_attached(qvmc, device): xml = None except libvirt.libvirtError: if vmm.libvirt_conn.virConnGetLastError()[0] == libvirt.VIR_ERR_NO_DOMAIN: - libvirt_domain = None + xml = None else: raise if xml: @@ -783,6 +786,9 @@ class QubesWatch(object): if e.args[0] != 2: raise time.sleep(0.5) + if name not in self._qdb: + # domain no longer active + return else: name = "dom0" self._qdb[name] = QubesDB(name)