[PATCH v4 20/23] qemu: Bypass sending VIR_DOMAIN_EVENT_RESUMED event when TD VM reboot

Zhenzhong Duan posted 23 patches 2 months ago
[PATCH v4 20/23] qemu: Bypass sending VIR_DOMAIN_EVENT_RESUMED event when TD VM reboot
Posted by Zhenzhong Duan 2 months ago
When TD VM reboot, qemu process is recreated by destroying old and
creating new one. When new qemu process starts, it sends a RESUME
event while libvirt domain isn't in run state yet. Then event
VIR_DOMAIN_EVENT_RESUMED is sent out and confuse control plane.

Check priv->pausedShutdown and bypass the event for TD VM, for
normal VM, domain is in run state and already bypassing it.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
 src/qemu/qemu_process.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 7467a378ad..68c0a5b64d 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -812,9 +812,11 @@ qemuProcessHandleResume(qemuMonitor *mon G_GNUC_UNUSED,
                 reason = VIR_DOMAIN_RUNNING_POSTCOPY;
         }
         virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, reason);
-        event = virDomainEventLifecycleNewFromObj(vm,
-                                                  VIR_DOMAIN_EVENT_RESUMED,
-                                                  eventDetail);
+
+        if (!priv->pausedShutdown)
+            event = virDomainEventLifecycleNewFromObj(vm,
+                                                      VIR_DOMAIN_EVENT_RESUMED,
+                                                      eventDetail);
         qemuDomainSaveStatus(vm);
     }
 
-- 
2.47.1
RE: [PATCH v4 20/23] qemu: Bypass sending VIR_DOMAIN_EVENT_RESUMED event when TD VM reboot
Posted by Duan, Zhenzhong 1 month, 1 week ago
Hi Daniel,

We just find this patch is missed in upstream branch, is it dropped for some reason?

Thanks
Zhenzhong

>-----Original Message-----
>From: Duan, Zhenzhong <zhenzhong.duan@intel.com>
>Subject: [PATCH v4 20/23] qemu: Bypass sending
>VIR_DOMAIN_EVENT_RESUMED event when TD VM reboot
>
>When TD VM reboot, qemu process is recreated by destroying old and
>creating new one. When new qemu process starts, it sends a RESUME
>event while libvirt domain isn't in run state yet. Then event
>VIR_DOMAIN_EVENT_RESUMED is sent out and confuse control plane.
>
>Check priv->pausedShutdown and bypass the event for TD VM, for
>normal VM, domain is in run state and already bypassing it.
>
>Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
>Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
>---
> src/qemu/qemu_process.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
>diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
>index 7467a378ad..68c0a5b64d 100644
>--- a/src/qemu/qemu_process.c
>+++ b/src/qemu/qemu_process.c
>@@ -812,9 +812,11 @@ qemuProcessHandleResume(qemuMonitor *mon
>G_GNUC_UNUSED,
>                 reason = VIR_DOMAIN_RUNNING_POSTCOPY;
>         }
>         virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, reason);
>-        event = virDomainEventLifecycleNewFromObj(vm,
>-
>VIR_DOMAIN_EVENT_RESUMED,
>-                                                  eventDetail);
>+
>+        if (!priv->pausedShutdown)
>+            event = virDomainEventLifecycleNewFromObj(vm,
>+
>VIR_DOMAIN_EVENT_RESUMED,
>+
>eventDetail);
>         qemuDomainSaveStatus(vm);
>     }
>
>--
>2.47.1
Re: [PATCH v4 20/23] qemu: Bypass sending VIR_DOMAIN_EVENT_RESUMED event when TD VM reboot
Posted by Daniel P. Berrangé via Devel 1 month, 1 week ago
Sorry, I must have messed up with fetching the patches, and this
mistake didn't cause a build failure. I've pushed it now.

On Thu, Jul 31, 2025 at 02:05:10AM +0000, Duan, Zhenzhong wrote:
> Hi Daniel,
> 
> We just find this patch is missed in upstream branch, is it dropped for some reason?
> 
> Thanks
> Zhenzhong
> 
> >-----Original Message-----
> >From: Duan, Zhenzhong <zhenzhong.duan@intel.com>
> >Subject: [PATCH v4 20/23] qemu: Bypass sending
> >VIR_DOMAIN_EVENT_RESUMED event when TD VM reboot
> >
> >When TD VM reboot, qemu process is recreated by destroying old and
> >creating new one. When new qemu process starts, it sends a RESUME
> >event while libvirt domain isn't in run state yet. Then event
> >VIR_DOMAIN_EVENT_RESUMED is sent out and confuse control plane.
> >
> >Check priv->pausedShutdown and bypass the event for TD VM, for
> >normal VM, domain is in run state and already bypassing it.
> >
> >Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
> >Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> >---
> > src/qemu/qemu_process.c | 8 +++++---
> > 1 file changed, 5 insertions(+), 3 deletions(-)
> >
> >diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> >index 7467a378ad..68c0a5b64d 100644
> >--- a/src/qemu/qemu_process.c
> >+++ b/src/qemu/qemu_process.c
> >@@ -812,9 +812,11 @@ qemuProcessHandleResume(qemuMonitor *mon
> >G_GNUC_UNUSED,
> >                 reason = VIR_DOMAIN_RUNNING_POSTCOPY;
> >         }
> >         virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, reason);
> >-        event = virDomainEventLifecycleNewFromObj(vm,
> >-
> >VIR_DOMAIN_EVENT_RESUMED,
> >-                                                  eventDetail);
> >+
> >+        if (!priv->pausedShutdown)
> >+            event = virDomainEventLifecycleNewFromObj(vm,
> >+
> >VIR_DOMAIN_EVENT_RESUMED,
> >+
> >eventDetail);
> >         qemuDomainSaveStatus(vm);
> >     }
> >
> >--
> >2.47.1
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|