1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-08-02 04:21:59 +03:00

event-test: Add storage pool lifecycle event tests

This commit is contained in:
Jovanka Gulicoska
2016-06-14 23:22:24 +02:00
committed by Cole Robinson
parent 7eaab4a6c2
commit d42cb2b170

View File

@ -564,6 +564,23 @@ def myNetworkEventLifecycleCallback(conn, net, event, detail, opaque):
netEventToString(event),
netDetailToString(event, detail)))
##########################################################################
# Storage pool events
##########################################################################
def storageEventToString(event):
storageEventStrings = ( "Defined",
"Undefined",
"Started",
"Stopped",
"Refreshed",
)
return storageEventStrings[event]
def myStoragePoolEventLifecycleCallback(conn, pool, event, detail, opaque):
print("myStoragePoolEventLifecycleCallback: Storage pool %s %s %d" % (pool.name(),
storageEventToString(event),
detail))
##########################################################################
# Set up and run the program
##########################################################################
@ -655,6 +672,7 @@ def main():
vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED, myDomainEventDeviceRemovalFailedCallback, None)
vc.networkEventRegisterAny(None, libvirt.VIR_NETWORK_EVENT_ID_LIFECYCLE, myNetworkEventLifecycleCallback, None)
vc.storagePoolEventRegisterAny(None, libvirt.VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE, myStoragePoolEventLifecycleCallback, None)
vc.setKeepAlive(5, 3)