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

Add support for storage pool refesh callback

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange
2016-06-24 18:37:09 +01:00
parent 923a2d9b86
commit cb84e36cb3
3 changed files with 70 additions and 2 deletions

View File

@ -572,7 +572,6 @@ def storageEventToString(event):
"Undefined",
"Started",
"Stopped",
"Refreshed",
)
return storageEventStrings[event]
@ -581,6 +580,9 @@ def myStoragePoolEventLifecycleCallback(conn, pool, event, detail, opaque):
storageEventToString(event),
detail))
def myStoragePoolEventRefreshCallback(conn, pool, event, detail, opaque):
print("myStoragePoolEventRefreshCallback: Storage pool %s" % pool.name())
##########################################################################
# Set up and run the program
##########################################################################
@ -672,7 +674,9 @@ 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.storagePoolEventRegisterAny(None, libvirt.VIR_STORAGE_POOL_EVENT_ID_REFRESH, myStoragePoolEventRefreshCallback, None)
vc.setKeepAlive(5, 3)