[PATCH 17/22] qemuProcessHandleReset: Don't emulate lifecycle actions for RESET event

Peter Krempa pkrempa at redhat.com
Tue Aug 24 14:44:38 UTC 2021


The RESET event is delivered by qemu only when the guest OS is actually
allowed to reboot ('-no-reboot' or equivalent is not used) and due to
the nature of async handling of the events VM is actually already
executing guest code after the reboot, until our code gets to killing
it.

In general it should have been impossible to reach a state where the
reboot action is 'destroy' but we didn't use '-no-reboot' but due to
various bugs it was.

Due to the fact that this was not a desired operation and additionally
guest code already is executing I think the best option is not to kill
the VM any more (possible data loss?) and rely for the proper fix where
we use the new 'set-action' QMP command to enable an equivalent
behaviour to '-no-reboot' during runtime.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_process.c | 21 ---------------------
 1 file changed, 21 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index c9cdff4e82..a839d587c2 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -443,27 +443,6 @@ qemuProcessHandleReset(qemuMonitor *mon G_GNUC_UNUSED,
     if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
         VIR_WARN("Failed to save status on vm %s", vm->def->name);

-    if (vm->def->onReboot == VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY ||
-        vm->def->onReboot == VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE) {
-
-        if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
-            goto cleanup;
-
-        if (!virDomainObjIsActive(vm)) {
-            VIR_DEBUG("Ignoring RESET event from inactive domain %s",
-                      vm->def->name);
-            goto endjob;
-        }
-
-        qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED,
-                        QEMU_ASYNC_JOB_NONE, 0);
-        virDomainAuditStop(vm, "destroyed");
-        qemuDomainRemoveInactive(driver, vm);
-     endjob:
-        qemuDomainObjEndJob(driver, vm);
-    }
-
- cleanup:
     virObjectUnlock(vm);
     virObjectEventStateQueue(driver->domainEventState, event);
 }
-- 
2.31.1




More information about the libvir-list mailing list