Commit Graph

3 Commits

Author SHA1 Message Date
Cédric Bosdonnat
0d32cb9228 libvirt events: fix domain defined/updated event details
Libvirt events algorigthm converting the libvirt enums into string has a
flaw that unit tests couldn't see. Libvirt python binding defines the
following constants:

VIR_DOMAIN_EVENT_CRASHED_PANICKED = 0
VIR_DOMAIN_EVENT_DEFINED = 0
VIR_DOMAIN_EVENT_CRASHED = 8

However VIR_DOMAIN_EVENT_CRASHED_PANICKED is the only value in this enum
and thus wasn't not considered a sub-enum element. So the value 0 in
enum 'VIR_DOMAIN_EVENT_' was wrongly mapped to "crashed panicked"
instead of "defined".

In order to safely rule this case out, check if we have an item that
just ends with the subprefix without the '_'.
2018-12-18 16:00:15 +01:00
Gareth J. Greenaway
7740e413da
Fixing unit.engines.test_libvirt_events.test_event_register to ensure the return value is correct and the engine does not loop forever. 2018-04-25 10:32:40 -07:00
Cédric Bosdonnat
7abcaf26b0
Add engine relaying libvirt events
Libvirt API offers clients to register callbacks for various events.
libvirt_events engine will listen on a libvirt URI (local or remote)
for events and send them to the salt event bus.

Special thanks to @isbm for the code cleanup help
2018-03-28 15:38:25 +02:00