Hi all,
I registe node device lifecycle event callback function after connect qemu. In the
callback function, I printf the event and detail.
When I plug a USB into host, and then pull out, but there is nothing happen. The callback
was not called.
Could you tell me Why? And what dose node device mean?
I want to auto-hotplug usb devices by using libvirt.
Bellow the call of libvirt:
// node device lifecycle callback function
void nodeDeviceEventLifecycleCallback(virConnectPtr conn, virNodeDevicePtr dev, int
event,
int detail, void * opaque)
{
printf("event = %d, detail= %d\n", event, detail);
}
// registe node device lifecycle event
int registeNodeDevEvent()
{
int ret = virEventRegisterDefaultImpl();
if (ret) { return -1;}
ret = virConnectNodeDeviceEventRegisterAny(vmh_conn, NULL,
VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE,
VIR_NODE_DEVICE_EVENT_CALLBACK(nodeDeviceEventLifecycleCallback), NULL,
NULL);
if (-1 == ret) { return ret;}
}
Below some information about my hypervisor:
root@ubuntu-05:/datapool/zhuohf# virsh -v
3.4.0
root@ubuntu-05:/datapool/zhuohf# qemu-x86_64 -version
qemu-x86_64 version 2.9.0
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
Show replies by date