[libvirt] [PATCH] libxl: rework setting the state of virDomainObj

Jim Fehlig jfehlig at suse.com
Wed Jul 8 21:50:02 UTC 2015


On 07/08/2015 09:01 AM, Michal Privoznik wrote:
> On 08.07.2015 00:34, Jim Fehlig wrote:
>> Set the state of virDomainObj in the functions that
>> actually change the domain state, instead of the generic
>> libxlDomainCleanup function. This approach gives functions
>> calling libxlDomainCleanup more flexibility wrt when and
>> how they change virDomainObj state via virDomainObjSetState.
>>
>> The prior approach of calling virDomainObjSetState in
>> libxlDomainCleanup resulted in the following incorrect
>> coding pattern in the various functions that change
>> domain state
>>
>>   libxlDomain<DoStateTransition>
>>     call libxl function to do state transition
>>     emit lifecycle event
>>     libxlDomainCleanup
>>       virDomainObjSetState
>>
>> Once simple manifestation of this bug is seeing a domain
>> running in virt-manager after selecting the shutdown button,
>> even after the domain has long shutdown.
>>
>> Signed-off-by: Jim Fehlig <jfehlig at suse.com>
>> ---
>>
>> I considered emitting the lifecycle event in libxlDomainCleanup,
>> but IMO it is best to change the state and emit the event where
>> where the state change actually occurs.
>>
>>   src/libxl/libxl_domain.c    | 23 ++++++++++++-----------
>>   src/libxl/libxl_domain.h    |  3 +--
>>   src/libxl/libxl_driver.c    | 28 ++++++++++++++++++----------
>>   src/libxl/libxl_migration.c |  8 ++++++--
>>   4 files changed, 37 insertions(+), 25 deletions(-)
> ACK

Thanks again :-).  Pushed now.

Regards,
Jim




More information about the libvir-list mailing list