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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
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@xxxxxxxx>
---
 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);
-- 
1.8.1.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]