From 124a26ec973a8c47b46dc02f82b785d6c571c5f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 29 Mar 2015 16:21:33 +0200 Subject: [PATCH] core: do not undefine libvirt domain when not necessary Libvirt will replace domain XML when trying to define the new one with the same name and UUID - this is exactly what we need. This fixes race condition with other processes (especially Qubes Manager), which can try to access that libvirt domain object at the same time. --- core-modules/000QubesVm.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/core-modules/000QubesVm.py b/core-modules/000QubesVm.py index 04a3a2a3..db1bfba2 100644 --- a/core-modules/000QubesVm.py +++ b/core-modules/000QubesVm.py @@ -562,7 +562,6 @@ class QubesVm(object): self.pre_rename(name) if self.libvirt_domain: self.libvirt_domain.undefine() - self._libvirt_domain = None if self._qdb_connection: self._qdb_connection.close() self._qdb_connection = None @@ -672,8 +671,6 @@ class QubesVm(object): def _update_libvirt_domain(self): domain_config = self.create_config_file() - if self._libvirt_domain: - self._libvirt_domain.undefine() try: self._libvirt_domain = vmm.libvirt_conn.defineXML(domain_config) self.uuid = uuid.UUID(bytes=self._libvirt_domain.UUID())