[libvirt] [PATCH V2 7/7] qemuDomainDeviceDefPostParse: add USB controller model check

Chunyan Liu cyliu at suse.com
Wed Jun 15 06:00:14 UTC 2016


To sync with virDomainControllerModelUSB, we add two models
in qemuControllerModelUSB 'qusb1' and 'qusb2', but those
models are not supported in qemu driver. So add check in
device post parse to report errors if 'qusb1' and 'qusb2'
are specified.

Signed-off-by: Chunyan Liu <cyliu at suse.com>
---
 src/qemu/qemu_domain.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d1f8175..ed72393 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2301,6 +2301,19 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
         ARCH_IS_S390(def->os.arch))
         dev->data.controller->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE;
 
+    /* forbid usb model 'qusb1' and 'qusb2' in this kind of hyperviosr */
+    if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER &&
+        dev->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
+        (dev->data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB1 ||
+         dev->data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB2)) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("USB controller model type 'qusb1' or 'qusb2' "
+                         "is not supported in %s"),
+                       virDomainVirtTypeToString(def->virtType));
+        goto cleanup;
+    }
+
+
     /* set the default SCSI controller model for S390 arches */
     if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER &&
         dev->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI &&
-- 
2.1.4




More information about the libvir-list mailing list