]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuProcessHandleReset: Don't emulate lifecycle actions for RESET event
authorPeter Krempa <pkrempa@redhat.com>
Fri, 20 Aug 2021 14:16:46 +0000 (16:16 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 25 Aug 2021 13:32:44 +0000 (15:32 +0200)
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@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_process.c

index 6eb104c70b8649f45faaefaaea03d9fe2888b037..3e87ddc11e11133e4ce5502076c5b42486b6c898 100644 (file)
@@ -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);
 }