Re: [libvirt-users] event-test.py cannot detects domain shutdown

2014년 2월 11일 오후 10:00에 Eric Blake <eblake@redhat.com> 작성: On 02/11/2014 12:20 AM, Kim Larry wrote: libvirtd version is 1.1.4 and using Xen for hypervisor. I'm not as familiar with the xen hypervisor as with qemu; it may just be the case that no one has coded the xen driver to send a shutdown event. At any rate, I can confirm that with the qemu driver, shutdown events are delivered. It is a bit weird that all except shutdown event are coded... If it is true, do I have to just wait? https://rwmj.wordpress.com/2010/11/08/want-help-dont-email-me-directly/ Or you could look into the source code and provide a patch; but discussing this on the list is a better way to get a reaction from someone familiar with the xen code. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org Ah, I forgot to add libvirt-users in Cc... sorry. The thing I found today is that if libvirt uses xend driver, shutdown events are delivered, but if libvirt uses libxl drvier, doesn't show up anything. It seems there are bugs on shutdown event, so I did dig into the libvirt source briefly, but I couldn't find where libxl driver calls event callback. Any help will be greatly appreciated. Especially someone who is familiar with xen code.

On 02/18/2014 05:12 AM, Kim Larry wrote:
2014년 2월 11일 오후 10:00에 Eric Blake <eblake@redhat.com> 작성:
On 02/11/2014 12:20 AM, Kim Larry wrote:
libvirtd version is 1.1.4 and using Xen for hypervisor. I'm not as familiar with the xen hypervisor as with qemu; it may just be the case that no one has coded the xen driver to send a shutdown event. At any rate, I can confirm that with the qemu driver, shutdown events are delivered.
It is a bit weird that all except shutdown event are coded... If it is true, do I have to just wait?
https://rwmj.wordpress.com/2010/11/08/want-help-dont-email-me-directly/
Or you could look into the source code and provide a patch; but discussing this on the list is a better way to get a reaction from someone familiar with the xen code.
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Ah, I forgot to add libvirt-users in Cc... sorry.
The thing I found today is that if libvirt uses xend driver, shutdown events are delivered, but if libvirt uses libxl drvier, doesn't show up anything. It seems there are bugs on shutdown event, so I did dig into the libvirt source briefly, but I couldn't find where libxl driver calls event callback.
Any help will be greatly appreciated. Especially someone who is familiar with xen code.
Jim, does this sound familiar? - Cole

Cole Robinson wrote:
On 02/18/2014 05:12 AM, Kim Larry wrote:
The thing I found today is that if libvirt uses xend driver, shutdown events are delivered, but if libvirt uses libxl drvier, doesn't show up anything. It seems there are bugs on shutdown event, so I did dig into the libvirt source briefly, but I couldn't find where libxl driver calls event callback.
Any help will be greatly appreciated. Especially someone who is familiar with xen code.
Jim, does this sound familiar?
Looks like the event handler only queues a crashed event when receiving the shutdown event from libxl. The attached patch should fix it, but I think the logic could be further improved. I'll look at doing that tomorrow. Regards, Jim

On 02/18/2014 10:45 PM, Jim Fehlig wrote:
Cole Robinson wrote:
On 02/18/2014 05:12 AM, Kim Larry wrote:
The thing I found today is that if libvirt uses xend driver, shutdown events are delivered, but if libvirt uses libxl drvier, doesn't show up anything. It seems there are bugs on shutdown event, so I did dig into the libvirt source briefly, but I couldn't find where libxl driver calls event callback.
Any help will be greatly appreciated. Especially someone who is familiar with xen code.
Jim, does this sound familiar?
Looks like the event handler only queues a crashed event when receiving the shutdown event from libxl. The attached patch should fix it, but I think the logic could be further improved. I'll look at doing that tomorrow.
Regards, Jim
From c05615b29f8870d20b4457a2e8abe5e4195275c2 Mon Sep 17 00:00:00 2001 From: Jim Fehlig <jfehlig@suse.com> Date: Tue, 18 Feb 2014 20:34:47 -0700 Subject: [PATCH] libxl: queue shutdown event on domain shutdown
Emmit libvirt shutdown event when receiving LIBXL_SHUTDOWN_REASON_POWEROFF event from libxl.
Signed-off-by: Jim Fehlig <jfehlig@suse.com> --- src/libxl/libxl_driver.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 8e4242a..8d5e101 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -383,6 +383,9 @@ libxlDomainShutdownThread(void *opaque) VIR_DOMAIN_EVENT_STOPPED_CRASHED); reason = VIR_DOMAIN_SHUTOFF_CRASHED; } else { + dom_event = virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_STOPPED, + VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN); reason = VIR_DOMAIN_SHUTOFF_SHUTDOWN; } libxlVmReap(driver, vm, reason);
ACK, looks fine to me, but I'm guessing the REBOOT handling right below also needs an event dispatched. Probably best to see what the qemu or test driver do for reboot and copy it. - Cole

Cole Robinson wrote:
On 02/18/2014 10:45 PM, Jim Fehlig wrote:
Cole Robinson wrote:
On 02/18/2014 05:12 AM, Kim Larry wrote:
The thing I found today is that if libvirt uses xend driver, shutdown events are delivered, but if libvirt uses libxl drvier, doesn't show up anything. It seems there are bugs on shutdown event, so I did dig into the libvirt source briefly, but I couldn't find where libxl driver calls event callback.
Any help will be greatly appreciated. Especially someone who is familiar with xen code.
Jim, does this sound familiar?
Looks like the event handler only queues a crashed event when receiving the shutdown event from libxl. The attached patch should fix it, but I think the logic could be further improved. I'll look at doing that tomorrow.
Regards, Jim
From c05615b29f8870d20b4457a2e8abe5e4195275c2 Mon Sep 17 00:00:00 2001 From: Jim Fehlig <jfehlig@suse.com> Date: Tue, 18 Feb 2014 20:34:47 -0700 Subject: [PATCH] libxl: queue shutdown event on domain shutdown
Emmit libvirt shutdown event when receiving LIBXL_SHUTDOWN_REASON_POWEROFF event from libxl.
Signed-off-by: Jim Fehlig <jfehlig@suse.com> --- src/libxl/libxl_driver.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 8e4242a..8d5e101 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -383,6 +383,9 @@ libxlDomainShutdownThread(void *opaque) VIR_DOMAIN_EVENT_STOPPED_CRASHED); reason = VIR_DOMAIN_SHUTOFF_CRASHED; } else { + dom_event = virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_STOPPED, + VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN); reason = VIR_DOMAIN_SHUTOFF_SHUTDOWN; } libxlVmReap(driver, vm, reason);
ACK, looks fine to me, but I'm guessing the REBOOT handling right below also needs an event dispatched. Probably best to see what the qemu or test driver do for reboot and copy it.
Looks like there is no explicit reboot event emitted, only a shutdown event when <on_reboot> is set to 'destroy'. Sadly, the libxl driver is currently ignoring the <on_*> event configuration :-(. I'll work on a fix for this. Regards, Jim

Jim Fehlig wrote:
Cole Robinson wrote:
On 02/18/2014 10:45 PM, Jim Fehlig wrote:
Cole Robinson wrote:
On 02/18/2014 05:12 AM, Kim Larry wrote:
The thing I found today is that if libvirt uses xend driver, shutdown events are delivered, but if libvirt uses libxl drvier, doesn't show up anything. It seems there are bugs on shutdown event, so I did dig into the libvirt source briefly, but I couldn't find where libxl driver calls event callback.
Any help will be greatly appreciated. Especially someone who is familiar with xen code.
Jim, does this sound familiar?
Looks like the event handler only queues a crashed event when receiving the shutdown event from libxl. The attached patch should fix it, but I think the logic could be further improved. I'll look at doing that tomorrow.
Regards, Jim
From c05615b29f8870d20b4457a2e8abe5e4195275c2 Mon Sep 17 00:00:00 2001 From: Jim Fehlig <jfehlig@suse.com> Date: Tue, 18 Feb 2014 20:34:47 -0700 Subject: [PATCH] libxl: queue shutdown event on domain shutdown
Emmit libvirt shutdown event when receiving LIBXL_SHUTDOWN_REASON_POWEROFF event from libxl.
Signed-off-by: Jim Fehlig <jfehlig@suse.com> --- src/libxl/libxl_driver.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 8e4242a..8d5e101 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -383,6 +383,9 @@ libxlDomainShutdownThread(void *opaque) VIR_DOMAIN_EVENT_STOPPED_CRASHED); reason = VIR_DOMAIN_SHUTOFF_CRASHED; } else { + dom_event = virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_STOPPED, + VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN); reason = VIR_DOMAIN_SHUTOFF_SHUTDOWN; } libxlVmReap(driver, vm, reason);
ACK, looks fine to me, but I'm guessing the REBOOT handling right below also needs an event dispatched. Probably best to see what the qemu or test driver do for reboot and copy it.
I've pushed this patch.
Looks like there is no explicit reboot event emitted, only a shutdown event when <on_reboot> is set to 'destroy'. Sadly, the libxl driver is currently ignoring the <on_*> event configuration :-(. I'll work on a fix for this.
And sent a series to fix this and cleanup the logic a bit https://www.redhat.com/archives/libvir-list/2014-February/msg01264.html Regards, Jim
participants (3)
-
Cole Robinson
-
Jim Fehlig
-
Kim Larry