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 '_'.
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