[libvirt] [PATCH] qemu: Remove inactive vm when failed to start it

Yi Wang posted 1 patch 6 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1497537548-48309-1-git-send-email-wang.yi59@zte.com.cn
src/qemu/qemu_driver.c | 2 ++
1 file changed, 2 insertions(+)
[libvirt] [PATCH] qemu: Remove inactive vm when failed to start it
Posted by Yi Wang 6 years, 10 months ago
Libvirt forgets to remove inactive vm when failed to start a defined vm.
That may result in residual domain in driver->domains on such condition:
during the process of starting a vm, undefine it, and qemu exit because
of some exception. As we undefined the vm successfully, the vm->persistent
was set to 0, we will always fail to undefine it until restart libvirtd.

Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
---
 src/qemu/qemu_driver.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ba1dba5..581f02f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7185,6 +7185,8 @@ qemuDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
 
  endjob:
     qemuProcessEndJob(driver, vm);
+    if (ret < 0)
+        qemuDomainRemoveInactive(driver, vm);
 
  cleanup:
     virDomainObjEndAPI(&vm);
-- 
1.8.3.1


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list