This patch enables the "none" USB controller for qemu guests and adds
valdiation on hot-plugged devices if the guest has USB disabled.
---
src/qemu/qemu_command.c | 7 +++++++
src/qemu/qemu_driver.c | 6 ++++++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5db72e8..232808c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4676,6 +4676,13 @@ qemuBuildCommandLine(virConnectPtr conn,
cont->type == VIR_DOMAIN_CONTROLLER_TYPE_FDC)
continue;
+ /* Also, skip USB controllers with type none.*/
+ if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
+ cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE) {
+ usbcontroller = -1; /* mark we don't want a controller */
+ continue;
+ }
+
/* Only recent QEMU implements a SATA (AHCI) controller */
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) {
if (!qemuCapsGet(qemuCaps, QEMU_CAPS_ICH9_AHCI)) {
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3138fb3..cbe4857 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5827,6 +5827,9 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
}
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
+ if (virDomainDefCompatibleDevice(vmdef, dev) < 0)
+ goto endjob;
+
/* Make a copy for updated domain. */
vmdef = virDomainObjCopyPersistentDef(driver->caps, vm);
if (!vmdef)
@@ -5852,6 +5855,9 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
}
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
+ if (virDomainDefCompatibleDevice(vm->def, dev_copy) < 0)
+ goto endjob;
+
switch (action) {
case QEMU_DEVICE_ATTACH:
ret = qemuDomainAttachDeviceLive(vm, dev_copy, dom);
--
1.7.8.6