Jim Fehlig
2014-Feb-19 03:45 UTC
Re: [libvirt-users] event-test.py cannot detects domain shutdown
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
Cole Robinson
2014-Feb-19 15:58 UTC
Re: [libvirt-users] event-test.py cannot detects domain shutdown
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
Jim Fehlig
2014-Feb-19 17:21 UTC
Re: [libvirt-users] event-test.py cannot detects domain shutdown
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
Reasonably Related Threads
- Re: event-test.py cannot detects domain shutdown
- Re: event-test.py cannot detects domain shutdown
- xen/libvirt freeze while attching network-device to vm´s
- Re: About debugging of libvirt.
- Re: [libvirt] [PATCH RESENT 04/12] libxl: populate xenstore memory entries at startup