From 3f4ee9f8d940f2a3cf956b013aba7daa8381aa40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Thu, 27 Feb 2020 10:31:28 +0100 Subject: [PATCH] xid: ensure vm is not running --- qubes/vm/qubesvm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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