Re: [PATCH V2] libxl: queue domain event earlier in shutdown handler

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

 



Michal Privoznik wrote:
> On 24.02.2014 19:06, Jim Fehlig wrote:
>> The shutdown handler may restart a domain when handling a reboot
>> event or when <on_*> is set to 'restart'.  Restarting consists of
>> calling libxlVmCleanup followed by libxlVmStart.  libxlVmStart will
>> emit a VIR_DOMAIN_EVENT_STARTED event, but the SHUTDOWN event is
>> not emitted until exiting the shutdown handler, after the STARTED
>> event.
>>
>> This patch changes the logic a bit to queue the event at the start
>> of the shutdown action, ensuring it is queued before any subsequent
>> events that may be generated while executing the shutdown action.
>>
>> Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
>> ---
>>
>> V2:
>> Enqueue any pending events at the beginning of the shutdown action
>> labels, as suggested by Michal Privoznik
>>
>> https://www.redhat.com/archives/libvir-list/2014-February/msg01446.html
>>
>>   src/libxl/libxl_driver.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
>> index f7379b5..a79efcb 100644
>> --- a/src/libxl/libxl_driver.c
>> +++ b/src/libxl/libxl_driver.c
>> @@ -473,6 +473,10 @@ libxlDomainShutdownThread(void *opaque)
>>       }
>>
>>   destroy:
>> +    if (dom_event) {
>> +        libxlDomainEventQueue(driver, dom_event);
>> +        dom_event = NULL;
>> +    }
>>       libxl_domain_destroy(ctx, vm->def->id, NULL);
>>       if (libxlVmCleanupJob(driver, vm, reason)) {
>>           if (!vm->persistent) {
>> @@ -483,6 +487,10 @@ destroy:
>>       goto cleanup;
>>
>>   restart:
>> +    if (dom_event) {
>> +        libxlDomainEventQueue(driver, dom_event);
>> +        dom_event = NULL;
>> +    }
>>       libxl_domain_destroy(ctx, vm->def->id, NULL);
>>       libxlVmCleanupJob(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN);
>>       libxlVmStart(driver, vm, 0, -1);
>>
>
> ACK

Thanks, pushed now.

Regards,
Jim

--
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]