We currently have a set of domain lifecycle events VIR_DOMAIN_EVENT_ADDED = 0, VIR_DOMAIN_EVENT_REMOVED = 1, VIR_DOMAIN_EVENT_STARTED = 2, VIR_DOMAIN_EVENT_SUSPENDED = 3, VIR_DOMAIN_EVENT_RESUMED = 4, VIR_DOMAIN_EVENT_STOPPED = 5, VIR_DOMAIN_EVENT_SAVED = 6, VIR_DOMAIN_EVENT_RESTORED = 7, And a couple more I proposed last week to allow distinguishing of new domains which are transient vs persistent VIR_DOMAIN_EVENT_DEFINED = 8, VIR_DOMAIN_EVENT_UNDEFINED = 9, Previously Stefan has suggested we should consider having an event for migration, and though I rejected that at the time, I'm now inclined to agree that this info would be useful here. I'm also thinking I'd like to have more information about STOPPED & STARTED events in general. eg, there are a number of reasons why an domain may have started - explicitly booted on the host - restored from a saved image - incoming migration operation and there are a number of reasons why a domain might have stopped - forcably destroyed by host admin - shutdown by host admin - shutdown by guest admin - host emulator process crashed - killed by mgmt after host emulation hung - migrated to another host - saved to a memory image We have explicit events for the SAVED/RESTORED reasons, but what should we do about the other reasons ? One option is to add alot more events VIR_DOMAIN_MIGRATED_IN (migrated to another node) VIR_DOMAIN_MIGRATED_OUT (migrated from another node) VIR_DOMAIN_SHUTDOWN (graceful shutdown by host admin) VIR_DOMAIN_DESTROYED (force destroyed by host admin) VIR_DOMAIN_CRASHED (guest kernel crashed) VIR_DOMAIN_HUNG (host emulator hung) leaving STOPPED to just be a generic stop event, with no particular reason. The downside with this, is if an application just wants to know about whether a domain shutdown, not why, then they have to track lots and lots of events. Also, not every driver would be able to provide all of these events, so would often have to fallback on a generic STOPPED event So one alternative is to provide a generic 'char * reason' with each event with provides scope on the cause of the lifecycle operation. So you'd get VIR_DOMAIN_STOPPED ("crashed", "shutdown", "destroyed", "quit", "hung", "migrated", "saved") VIR_DOMAIN_STARTED ("booted", "migrated", "restored") nb, we could remove the explicit SAVED and RESTORED events in this style. With such a 'reason' arg, we could possibly avoid adding the DEFINED and UNDEFINED events I suggested. Instead, adding a reason for ADDED and REMOVED events, VIR_DOMAIN_ADDED ("started", "defined") VIR_DOMAIN_REMOVED ("shutdown", "undefined") which lets you distinguish transient from persistent domains. The downside of this though, is that we can't explicitly track when a configuration file is 're-defined', eg adding a config file for an existing running guest. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list