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@xxxxxxxx> > --- > > 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 Michal -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list