[PATCH v1 1/2] qemu_process: set fakereboot flags false after processing fakereboot over

Bihong Yu yubihong at huawei.com
Mon Oct 25 09:04:54 UTC 2021


During the vm rebooting, the vm could be shut down if the libvirtd is
restarted for some reason, which is not expected. We move set
fakereboot flags false after processing fakereboot over, so we can
ensure that fakereboot process have been executed.

Signed-off-by: Bihong Yu <yubihong at huawei.com>
---
 src/qemu/qemu_process.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 6027b30405..832ce164fb 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -523,6 +523,7 @@ qemuProcessFakeReboot(void *opaque)
 
  cleanup:
     priv->pausedShutdown = false;
+    qemuDomainSetFakeReboot(driver, vm, false);
     if (ret == -1)
         ignore_value(qemuProcessKill(vm, VIR_QEMU_PROCESS_KILL_FORCE));
     virDomainObjEndAPI(&vm);
@@ -540,7 +541,6 @@ qemuProcessShutdownOrReboot(virQEMUDriver *driver,
         g_autofree char *name = g_strdup_printf("reboot-%s", vm->def->name);
         virThread th;
 
-        qemuDomainSetFakeReboot(driver, vm, false);
         virObjectRef(vm);
         if (virThreadCreateFull(&th,
                                 false,
@@ -551,6 +551,7 @@ qemuProcessShutdownOrReboot(virQEMUDriver *driver,
             VIR_ERROR(_("Failed to create reboot thread, killing domain"));
             ignore_value(qemuProcessKill(vm, VIR_QEMU_PROCESS_KILL_NOWAIT));
             priv->pausedShutdown = false;
+            qemuDomainSetFakeReboot(driver, vm, false);
             virObjectUnref(vm);
         }
     } else {
-- 
2.27.0





More information about the libvir-list mailing list