[libvirt] [PATCH] domain_conf: Delete the USB controller check from the USB Device checklist on virDomainDeviceIsUSB

Michal Privoznik mprivozn at redhat.com
Thu Sep 5 10:56:14 UTC 2013


On 05.09.2013 04:40, Liuji (Jeremy) wrote:
> When using "virsh attach-device" to attach a device, the virDomainDefCompatibleDevice function will check the compatibility. 
> If the device is a USB device, but the VM don't have any USB controller, the execution of "virsh attach-device" will fails.
> It considers the USB controller as a USB device on virDomainDeviceIsUSB, so we can't use "virsh attach-device" to attach a 
> USB controller for a VM which don't have any other USB controller.
> 
> 
>>From ec3257407a9c4aadcd4554dcaad00d40387cf488 Mon Sep 17 00:00:00 2001
> From: Liu Ji <jeremy.liu at huawei.com>
> Date: Thu, 5 Sep 2013 09:56:42 +0800
> Subject: [PATCH] domain_conf: Delete the USB controller check from the USB
>  Device checklist on virDomainDeviceIsUSB
> 
> Delete the USB controller check from the USB Device checklist on virDomainDeviceIsUSB, otherwise we
> can't use "virsh attach-device" to attach a USB controller for a VM which don't have any other USB controller.
> 
> Signed-off-by: Liu Ji <jeremy.liu at huawei.com>
> ---
>  src/conf/domain_conf.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index e3aec69..ffb3254 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -16899,8 +16899,6 @@ virDomainDeviceIsUSB(virDomainDeviceDefPtr dev)
>      int t = dev->type;
>      if ((t == VIR_DOMAIN_DEVICE_DISK &&
>           dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_USB) ||
> -        (t == VIR_DOMAIN_DEVICE_CONTROLLER &&
> -         dev->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB) ||
>          (t == VIR_DOMAIN_DEVICE_INPUT &&
>           dev->data.input->type == VIR_DOMAIN_INPUT_BUS_USB) ||
>          (t == VIR_DOMAIN_DEVICE_HOSTDEV &&
> 

Although this won't help you to attach the usb controller (the only
controller that can be hotplugged currently is scsi), the USB controller
certainly isn't an USB device but PCI device instead. Having said that,
I'm rewording the commit message a bit.

ACKed and pushed.
Congratulations on your first libvirt commit!

Michal




More information about the libvir-list mailing list