]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuDomainUndefineFlags: unlink nvram file regardless of domain state
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 7 Aug 2017 11:18:23 +0000 (13:18 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 10 Aug 2017 07:30:15 +0000 (09:30 +0200)
https://bugzilla.redhat.com/show_bug.cgi?id=1467245

Currently, there's a bug when undefining a domain with NVRAM
store. Basically, the unlink() of the NVRAM store file happens
during the undefine procedure iff domain is inactive. So, if
domain is running and undefine is called the file is left behind.
It won't be removed in the domain cleanup process either
(qemuProcessStop). One of the solutions is to remove if
regardless of the domain state and rely on qemu having the file
opened. This still has a downside that if the domain is defined
back the NVRAM store file is going to be new, any changes to the
current one are lost (just like with any other file that is
deleted while a process has it opened). But is it really a
downside?

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_driver.c

index b3f65f440d42151a92c0301a24476462384b6f18..e6a50aef5b2c6dc2d7819e327c57521b6793b69f 100644 (file)
@@ -7364,8 +7364,8 @@ qemuDomainUndefineFlags(virDomainPtr dom,
         }
     }
 
-    if (!virDomainObjIsActive(vm) &&
-        vm->def->os.loader && vm->def->os.loader->nvram &&
+    if (vm->def->os.loader &&
+        vm->def->os.loader->nvram &&
         virFileExists(vm->def->os.loader->nvram)) {
         if ((flags & VIR_DOMAIN_UNDEFINE_NVRAM)) {
             if (unlink(vm->def->os.loader->nvram) < 0) {