From ac0063775bd8746709453475556a3a5f87cea4dd Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Sun, 21 Sep 2014 13:12:48 +0200 Subject: [PATCH 12/12] domain: relax the UNDEFINE_NVRAM condition precisely to libvirtd's one (1) A separate nvram (ie. variable store) file for the domain exists if and only if the following condition holds: (self.get_xmlobj().os.loader_ro is True and self.get_xmlobj().os.loader_type == "pflash") (Refer to libvirtd's qemuPrepareNVRAM() function, as of commit 742b08e30.) (2) The self.get_xmlobj().os.nvram condition is sufficient, but not necessary, for the separate varstore file to exist. That is, if the condition holds, then the separate varstore file exists for sure, but if the condition doesn't hold, the file may exist nonetheless. (Because libvirtd can auto-generate the varstore file's pathname.) This means that requiring condition (2) for setting UNDEFINE_NVRAM on domain deletion will miss a subset of the cases, ie. when the necessary and sufficient condition (1) holds, but the sufficient-only condition (2) doesn't. Make sure that the code uses the necessary and sufficient condition (1). Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1111986 Signed-off-by: Laszlo Ersek (cherry picked from commit 3e5b61da8633b69edb9d69aeab78bd86ad37d6e0) --- virtManager/domain.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/virtManager/domain.py b/virtManager/domain.py index f2cf009..d831cb3 100644 --- a/virtManager/domain.py +++ b/virtManager/domain.py @@ -1403,8 +1403,7 @@ class vmmDomain(vmmLibvirtObject): "VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA", 0) flags |= getattr(libvirt, "VIR_DOMAIN_UNDEFINE_MANAGED_SAVE", 0) if (self.get_xmlobj().os.loader_ro is True and - self.get_xmlobj().os.loader_type == "pflash" and - self.get_xmlobj().os.nvram): + self.get_xmlobj().os.loader_type == "pflash"): flags |= getattr(libvirt, "VIR_DOMAIN_UNDEFINE_NVRAM", 0) try: self._backend.undefineFlags(flags) -- 1.9.3