[PATCH v2 1/2] qemu: process: Ignore 'RESET' event during startup

Peter Krempa pkrempa at redhat.com
Mon Jul 26 08:48:13 UTC 2021


In cases when we are adding a <transient/> disk with sharing backend
(and thus hotplugging it) we need to re-initialize ACPI tables so that
the VM boots from the correct device.

This has a side-effect of emitting the RESET event and handling it which
in case when the 'on_reset' policy is set leads to an attempt to obtain
a domain job lock which is already held and needing to wait for a
timeout.

Fix this by ignoring RESET events during startup of the VM.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_process.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 521fda57da..f8581fa462 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -429,12 +429,24 @@ qemuProcessHandleReset(qemuMonitor *mon G_GNUC_UNUSED,
                        void *opaque)
 {
     virQEMUDriver *driver = opaque;
-    virObjectEvent *event;
+    virObjectEvent *event = NULL;
     qemuDomainObjPrivate *priv;
     g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
+    virDomainState state;
+    int reason;

     virObjectLock(vm);

+    state = virDomainObjGetState(vm, &reason);
+
+    /* ignore reset events on VM startup. Libvirt in certain instances does a
+     * reset during startup so that the ACPI tables are re-generated */
+    if (state == VIR_DOMAIN_PAUSED &&
+        reason == VIR_DOMAIN_PAUSED_STARTING_UP) {
+        VIR_DEBUG("ignoring reset event during startup");
+        goto cleanup;
+    }
+
     event = virDomainEventRebootNewFromObj(vm);
     priv = vm->privateData;
     if (priv->agent)
-- 
2.31.1




More information about the libvir-list mailing list