On Thu, Jul 12, 2012 at 11:30:58AM +0200, Peter Krempa wrote:
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 d202425..d828abc 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4786,6 +4786,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 5e831b7..96b58a0 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);
ACK
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|