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

Liuji (Jeremy) jeremy.liu at huawei.com
Thu Sep 5 02:40:25 UTC 2013


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 &&
-- 
1.7.11.7




More information about the libvir-list mailing list