From 0b5bd060bbdd07fdc46bab46f2862fd9a81fb63f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 6 Feb 2016 05:36:07 +0100 Subject: [PATCH] Fix domain renaming when it wasn't defined in libvirt Fixes QubesOS/qubes-issues#1632 --- core-modules/000QubesVm.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core-modules/000QubesVm.py b/core-modules/000QubesVm.py index 12fce513..b714f544 100644 --- a/core-modules/000QubesVm.py +++ b/core-modules/000QubesVm.py @@ -592,8 +592,13 @@ class QubesVm(object): raise QubesException("Cannot rename VM installed by RPM -- first clone VM and then use yum to remove package.") self.pre_rename(name) - if self.libvirt_domain: + try: self.libvirt_domain.undefine() + except libvirt.libvirtError as e: + if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN: + pass + else: + raise if self._qdb_connection: self._qdb_connection.close() self._qdb_connection = None