def guest_event_register(cls):
cls.conn = libvirt.open()
cls.conn.domainEventRegister(cls.guest_event_callback, None)
# ?????https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainEventID
cls.guest_callbacks.append(cls.conn.domainEventRegisterAny(
None, libvirt.VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION,
cls.guest_event_migration_iteration_callback, None))
cls.guest_callbacks.append(cls.conn.domainEventRegisterAny(
None, libvirt.VIR_DOMAIN_EVENT_ID_DEVICE_ADDED,
cls.guest_event_device_added_callback, None))
cls.guest_callbacks.append(cls.conn.domainEventRegisterAny(
None, libvirt.VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED,
cls.guest_event_device_removed_callback, None))
评论列表
文章目录