diff --git a/qubes/vm/qubesvm.py b/qubes/vm/qubesvm.py index f4cd0c6a..3419a0bd 100644 --- a/qubes/vm/qubesvm.py +++ b/qubes/vm/qubesvm.py @@ -690,7 +690,10 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): if self.libvirt_domain is None: return -1 try: - return self.libvirt_domain.ID() + if self.is_running(): + return self.libvirt_domain.ID() + else: + return -1 except libvirt.libvirtError as e: if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN: return -1