]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Avoid duplicate FakeReboot for secure guest
authorZhenzhong Duan <zhenzhong.duan@intel.com>
Thu, 10 Jul 2025 07:21:20 +0000 (03:21 -0400)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 25 Jul 2025 10:36:11 +0000 (11:36 +0100)
For secure guest, FakeReboot kills original QEMU instance and
create new one. During this process, QEMU send SHUTDOWN event
with "host-signal" reason which can trigger another FakeReboot.

Check if a FakeReboot is ongoing and bypass "host-signal"
processing which originally comes from FakeReboot.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/qemu/qemu_monitor.c

index 6d984df412e8392b815ae1fdb756e183810d94dd..d726175d42d1f1e69ecd69fab177c6369f61dca9 100644 (file)
@@ -1073,6 +1073,16 @@ qemuMonitorEmitShutdown(qemuMonitor *mon, virTristateBool guest,
      * with it here. */
     if (vm->def->sec &&
         vm->def->sec->sectype == VIR_DOMAIN_LAUNCH_SECURITY_TDX) {
+        qemuDomainObjPrivate *priv = vm->privateData;
+
+        /* For secure guest, FakeReboot kills original QEMU instance and
+         * create new one. During this process, QEMU send SHUTDOWN event
+         * with "host-signal" reason which can trigger another FakeReboot.
+         * Check if a FakeReboot is ongoing and bypass "host-signal"
+         * processing which is originally come from FakeReboot. */
+        if (priv->fakeReboot && STREQ_NULLABLE(reason, "host-signal"))
+            return;
+
         if ((STREQ_NULLABLE(reason, "guest-shutdown") &&
              vm->def->onPoweroff == VIR_DOMAIN_LIFECYCLE_ACTION_RESTART) ||
             (STREQ_NULLABLE(reason, "guest-reset") &&