[libvirt] QEMU applying for Google Summer of Code 2012
by Stefan Hajnoczi
This year's Google Summer of Code has been announced:
http://www.google-melange.com/gsoc/events/google/gsoc2012
For those who haven't heard of GSoC before, it funds university
students to work on open source projects during the summer.
Organizations, such as QEMU, can participate to attract students who
will tackle projects for 12 weeks this summer. The GSoC program has
been very successful because it gives students real open source
experience and organizations can grow their development community.
QEMU has participated for several years and I would like to organize
our participation this year. Luiz was QEMU organization administrator
last year and contacted me because he will not have time this year. I
will prepare the application form for QEMU so that we will be
considered for 2012.
Umbrella organization
---------------------
Like last year, we can provide a home for KVM kernel module and
libvirt projects too if those organizations prefer not to apply to
GSoC themselves. Please let us know so we can work together!
Ideas list
----------
The starting point for student candidates is our "Ideas List". I have
created a new page for this year - please add project ideas that you'd
like students to work on:
http://wiki.qemu.org/Google_Summer_of_Code_2012
Here is last year's list:
http://wiki.qemu.org/Google_Summer_of_Code_2011
A GSoC project should be achievable in 12 weeks by someone who is
competent in C programming but does not have prior QEMU coding
experience. Students normally work full-time (5 days per week).
Please also indicate if you are willing to mentor a student for your
project idea. I have provided a wiki template on the page so you can
easily add project ideas.
Mentors needed
--------------
Each student that we accept needs a mentor. Mentors are QEMU
developers who are willing to answer questions, review code, give
advice, and evaluate the student's progress. This is a time
commitment but also a good experience that I have enjoyed and would
recommend.
Timeline
--------
Please add project ideas to the wiki now:
http://wiki.qemu.org/Google_Summer_of_Code_2012
Feb 27 - Mar 9: I will submit QEMU's application form
Mar 17 - Apr 20: Mentors respond to student candidates, interview
them, and select the best candidate
May 21 - Aug 20: Students work on their projects
Please let me know if you have any questions or suggestions!
Stefan
12 years, 9 months
[libvirt] [PATCH libvirt] domain: add implicit USB controller
by Marc-André Lureau
Some tools, such as virt-manager, prefers having the default USB
controller explicit in the XML document. This patch makes sure there
is one. With this patch, it is now possible to switch from USB1 to
USB2 from the release 0.9.1 of virt-manager.
Fix tests to pass with this change.
---
src/conf/domain_conf.c | 93 ++++++++++---------
src/qemu/qemu_command.c | 8 ++-
tests/define-dev-segfault | 1 +
tests/domainsnapshotxml2xmlout/disk_snapshot.xml | 1 +
tests/domainsnapshotxml2xmlout/full_domain.xml | 1 +
tests/domainsnapshotxml2xmlout/metadata.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-bios.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml | 1 +
.../qemuxml2argv-blkiotune-device.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-blkiotune.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml | 1 +
.../qemuxml2argv-boot-complex-bootindex.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-boot-complex.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-boot-floppy.xml | 1 +
...uxml2argv-boot-menu-disable-drive-bootindex.xml | 1 +
.../qemuxml2argv-boot-menu-disable-drive.xml | 1 +
.../qemuxml2argv-boot-menu-disable.xml | 1 +
.../qemuxml2argv-boot-menu-enable.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-boot-multi.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-boot-network.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-boot-order.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-bootloader.xml | 1 +
.../qemuxml2argv-channel-guestfwd.xml | 1 +
.../qemuxml2argv-channel-spicevmc-old.xml | 1 +
.../qemuxml2argv-channel-spicevmc.xml | 1 +
.../qemuxml2argv-channel-virtio-auto.xml | 1 +
.../qemuxml2argv-channel-virtio.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-clock-france.xml | 1 +
.../qemuxml2argv-clock-localtime.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-clock-utc.xml | 1 +
.../qemuxml2argv-clock-variable.xml | 1 +
.../qemuxml2argv-console-compat-auto.xml | 1 +
.../qemuxml2argv-console-compat-chardev.xml | 1 +
.../qemuxml2argv-console-compat.xml | 1 +
.../qemuxml2argv-console-virtio-many.xml | 1 +
.../qemuxml2argv-console-virtio.xml | 1 +
.../qemuxml2argv-cpu-host-kvmclock.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-cpu-kvmclock.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-cputune.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-disk-aio.xml | 1 +
.../qemuxml2argv-disk-cdrom-empty.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.xml | 1 +
.../qemuxml2argv-disk-copy_on_read.xml | 1 +
.../qemuxml2argv-disk-drive-boot-cdrom.xml | 1 +
.../qemuxml2argv-disk-drive-boot-disk.xml | 1 +
.../qemuxml2argv-disk-drive-cache-directsync.xml | 1 +
.../qemuxml2argv-disk-drive-cache-unsafe.xml | 1 +
.../qemuxml2argv-disk-drive-cache-v1-none.xml | 1 +
.../qemuxml2argv-disk-drive-cache-v1-wb.xml | 1 +
.../qemuxml2argv-disk-drive-cache-v1-wt.xml | 1 +
.../qemuxml2argv-disk-drive-cache-v2-none.xml | 1 +
.../qemuxml2argv-disk-drive-cache-v2-wb.xml | 1 +
.../qemuxml2argv-disk-drive-cache-v2-wt.xml | 1 +
...muxml2argv-disk-drive-error-policy-enospace.xml | 1 +
.../qemuxml2argv-disk-drive-error-policy-stop.xml | 1 +
...rgv-disk-drive-error-policy-wreport-rignore.xml | 1 +
.../qemuxml2argv-disk-drive-fat.xml | 1 +
.../qemuxml2argv-disk-drive-fmt-qcow.xml | 1 +
.../qemuxml2argv-disk-drive-network-nbd.xml | 1 +
.../qemuxml2argv-disk-drive-network-rbd-auth.xml | 1 +
...emuxml2argv-disk-drive-network-rbd-ceph-env.xml | 1 +
.../qemuxml2argv-disk-drive-network-rbd.xml | 1 +
.../qemuxml2argv-disk-drive-network-sheepdog.xml | 1 +
.../qemuxml2argv-disk-drive-no-boot.xml | 1 +
.../qemuxml2argv-disk-drive-readonly-disk.xml | 1 +
.../qemuxml2argv-disk-drive-readonly-no-device.xml | 1 +
.../qemuxml2argv-disk-drive-shared.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-disk-floppy.xml | 1 +
.../qemuxml2argv-disk-ioeventfd.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-disk-many.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-disk-order.xml | 1 +
.../qemuxml2argv-disk-sata-device.xml | 1 +
.../qemuxml2argv-disk-scsi-device-auto.xml | 1 +
.../qemuxml2argv-disk-scsi-device.xml | 1 +
.../qemuxml2argv-disk-scsi-virtio-scsi.xml | 1 +
.../qemuxml2argv-disk-scsi-vscsi.xml | 1 +
.../qemuxml2argv-disk-snapshot.xml | 1 +
.../qemuxml2argv-disk-transient.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-disk-usb.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-disk-virtio.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-disk-xenvbd.xml | 1 +
.../qemuxml2argv-encrypted-disk.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-event_idx.xml | 1 +
.../qemuxml2argv-floppy-drive-fat.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-fs9p.xml | 1 +
.../qemuxml2argv-graphics-listen-network.xml | 1 +
.../qemuxml2argv-graphics-listen-network2.xml | 1 +
.../qemuxml2argv-graphics-sdl-fullscreen.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml | 1 +
.../qemuxml2argv-graphics-spice-compression.xml | 1 +
.../qemuxml2argv-graphics-spice-qxl-vga.xml | 1 +
.../qemuxml2argv-graphics-spice.xml | 1 +
.../qemuxml2argv-graphics-vnc-sasl.xml | 1 +
.../qemuxml2argv-graphics-vnc-socket.xml | 1 +
.../qemuxml2argv-graphics-vnc-tls.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml | 1 +
.../qemuxml2argv-hostdev-pci-address.xml | 1 +
.../qemuxml2argv-hostdev-usb-address.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-hugepages.xml | 1 +
.../qemuxml2argv-input-usbmouse-addr.xml | 1 +
.../qemuxml2argv-input-usbmouse.xml | 1 +
.../qemuxml2argv-input-usbtablet.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-input-xen.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-kvmclock.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-lease.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-memtune.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-migrate.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-minimal.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.xml | 1 +
.../qemuxml2argv-misc-no-reboot.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-misc-uuid.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-monitor-json.xml | 1 +
.../qemuxml2argv-net-bandwidth.xml | 1 +
.../qemuxml2argv-net-eth-ifname.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-net-eth.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-net-user.xml | 1 +
.../qemuxml2argv-net-virtio-device.xml | 1 +
.../qemuxml2argv-net-virtio-netdev.xml | 1 +
.../qemuxml2argv-net-virtio-network-portgroup.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-net-virtio.xml | 1 +
.../qemuxml2argv-nographics-vga.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-pci-rom.xml | 1 +
.../qemuxml2argv-qemu-ns-no-env.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-restore-v1.xml | 1 +
.../qemuxml2argv-restore-v2-fd.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-restore-v2.xml | 1 +
.../qemuxml2argv-seclabel-dynamic-baselabel.xml | 1 +
.../qemuxml2argv-seclabel-dynamic-override.xml | 1 +
.../qemuxml2argv-seclabel-none.xml | 1 +
.../qemuxml2argv-seclabel-static.xml | 1 +
.../qemuxml2argv-serial-dev-chardev.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-serial-dev.xml | 1 +
.../qemuxml2argv-serial-file-chardev.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-serial-file.xml | 1 +
.../qemuxml2argv-serial-many-chardev.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-serial-many.xml | 1 +
.../qemuxml2argv-serial-pty-chardev.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-serial-pty.xml | 1 +
.../qemuxml2argv-serial-tcp-chardev.xml | 1 +
.../qemuxml2argv-serial-tcp-telnet-chardev.xml | 1 +
.../qemuxml2argv-serial-tcp-telnet.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.xml | 1 +
.../qemuxml2argv-serial-udp-chardev.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml | 1 +
.../qemuxml2argv-serial-unix-chardev.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-serial-unix.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-serial-vc.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-smp.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-sound.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-virtio-lun.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-watchdog.xml | 1 +
.../qemuxml2xmlout-balloon-device-auto.xml | 1 +
.../qemuxml2xmlout-channel-virtio-auto.xml | 1 +
.../qemuxml2xmlout-console-compat-auto.xml | 1 +
.../qemuxml2xmlout-console-virtio.xml | 1 +
.../qemuxml2xmlout-disk-cdrom-empty.xml | 1 +
.../qemuxml2xmlout-disk-scsi-device-auto.xml | 1 +
.../qemuxml2xmlout-graphics-listen-network2.xml | 1 +
.../qemuxml2xmlout-graphics-spice-timeout.xml | 1 +
.../qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml | 1 +
.../qemuxml2xmlout-serial-target-port-auto.xml | 1 +
162 files changed, 216 insertions(+), 45 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6949ece..a1b5f8f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -619,7 +619,6 @@ VIR_ENUM_IMPL(virDomainStartupPolicy, VIR_DOMAIN_STARTUP_POLICY_LAST,
#define VIR_DOMAIN_XML_WRITE_FLAGS VIR_DOMAIN_XML_SECURE
#define VIR_DOMAIN_XML_READ_FLAGS VIR_DOMAIN_XML_INACTIVE
-
void
virBlkioDeviceWeightArrayClear(virBlkioDeviceWeightPtr deviceWeights,
int ndevices)
@@ -7091,6 +7090,49 @@ error:
}
+static int virDomainDefMaybeAddController(virDomainDefPtr def,
+ int type,
+ int idx)
+{
+ int found = 0;
+ int i;
+ virDomainControllerDefPtr cont;
+
+ for (i = 0 ; (i < def->ncontrollers) && !found; i++) {
+ if (def->controllers[i]->type == type &&
+ def->controllers[i]->idx == idx)
+ found = 1;
+ }
+
+ if (found)
+ return 0;
+
+ if (VIR_ALLOC(cont) < 0) {
+ virReportOOMError();
+ return -1;
+ }
+
+ cont->type = type;
+ cont->idx = idx;
+ cont->model = -1;
+
+ if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL) {
+ cont->opts.vioserial.ports = -1;
+ cont->opts.vioserial.vectors = -1;
+ }
+
+
+ if (VIR_REALLOC_N(def->controllers, def->ncontrollers+1) < 0) {
+ VIR_FREE(cont);
+ virReportOOMError();
+ return -1;
+ }
+ def->controllers[def->ncontrollers] = cont;
+ def->ncontrollers++;
+
+ return 0;
+}
+
static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
xmlDocPtr xml,
xmlNodePtr root,
@@ -7649,6 +7691,12 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
}
VIR_FREE(nodes);
+ if (def->virtType == VIR_DOMAIN_VIRT_QEMU ||
+ def->virtType == VIR_DOMAIN_VIRT_KQEMU ||
+ def->virtType == VIR_DOMAIN_VIRT_KVM)
+ if (virDomainDefMaybeAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_USB, 0) < 0)
+ goto error;
+
/* analysis of the resource leases */
if ((n = virXPathNodeSet("./devices/lease", ctxt, &nodes)) < 0) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
@@ -9378,49 +9426,6 @@ cleanup:
}
-static int virDomainDefMaybeAddController(virDomainDefPtr def,
- int type,
- int idx)
-{
- int found = 0;
- int i;
- virDomainControllerDefPtr cont;
-
- for (i = 0 ; (i < def->ncontrollers) && !found; i++) {
- if (def->controllers[i]->type == type &&
- def->controllers[i]->idx == idx)
- found = 1;
- }
-
- if (found)
- return 0;
-
- if (VIR_ALLOC(cont) < 0) {
- virReportOOMError();
- return -1;
- }
-
- cont->type = type;
- cont->idx = idx;
- cont->model = -1;
-
- if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL) {
- cont->opts.vioserial.ports = -1;
- cont->opts.vioserial.vectors = -1;
- }
-
-
- if (VIR_REALLOC_N(def->controllers, def->ncontrollers+1) < 0) {
- VIR_FREE(cont);
- virReportOOMError();
- return -1;
- }
- def->controllers[def->ncontrollers] = cont;
- def->ncontrollers++;
-
- return 0;
-}
-
static int virDomainDefAddDiskControllersForType(virDomainDefPtr def,
int controllerType,
int diskBus)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 0e26df1..e171641 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7621,7 +7621,13 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
WANT_VALUE();
/* ignore, generted on the fly */
} else if (STREQ(arg, "-usb")) {
- /* ignore, always added by libvirt */
+ virDomainControllerDefPtr ctldef;
+ if (VIR_ALLOC(ctldef) < 0)
+ goto no_memory;
+ ctldef->type = VIR_DOMAIN_CONTROLLER_TYPE_USB;
+ ctldef->idx = 0;
+ ctldef->model = -1;
+ virDomainControllerInsert(def, ctldef);
} else if (STREQ(arg, "-pidfile")) {
WANT_VALUE();
if (pidfile)
diff --git a/tests/define-dev-segfault b/tests/define-dev-segfault
index 3feff46..0a0532b 100755
--- a/tests/define-dev-segfault
+++ b/tests/define-dev-segfault
@@ -36,6 +36,7 @@ cat <<\EOF > D.xml || fail=1
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
+ <controller type='usb' index='0'/>
<serial type='pty'>
<target port='0'/>
</serial>
diff --git a/tests/domainsnapshotxml2xmlout/disk_snapshot.xml b/tests/domainsnapshotxml2xmlout/disk_snapshot.xml
index a0a0965..91dba79 100644
--- a/tests/domainsnapshotxml2xmlout/disk_snapshot.xml
+++ b/tests/domainsnapshotxml2xmlout/disk_snapshot.xml
@@ -69,6 +69,7 @@
<target dev='hdf' bus='ide'/>
<address type='drive' controller='0' bus='5' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/domainsnapshotxml2xmlout/full_domain.xml b/tests/domainsnapshotxml2xmlout/full_domain.xml
index 76f17e1..3063910 100644
--- a/tests/domainsnapshotxml2xmlout/full_domain.xml
+++ b/tests/domainsnapshotxml2xmlout/full_domain.xml
@@ -27,6 +27,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/domainsnapshotxml2xmlout/metadata.xml b/tests/domainsnapshotxml2xmlout/metadata.xml
index f0ad70b..9553b17 100644
--- a/tests/domainsnapshotxml2xmlout/metadata.xml
+++ b/tests/domainsnapshotxml2xmlout/metadata.xml
@@ -31,6 +31,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-bios.xml b/tests/qemuxml2argvdata/qemuxml2argv-bios.xml
index 5ce3e24..9b71164 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-bios.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-bios.xml
@@ -21,6 +21,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='pty'>
<target port='0'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml b/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml
index 7b6ec8f..6b4da65 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml
@@ -35,6 +35,7 @@
</iotune>
<address type='drive' controller='0' bus='0' unit='1'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-blkiotune-device.xml b/tests/qemuxml2argvdata/qemuxml2argv-blkiotune-device.xml
index 3412753..6c2d282 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-blkiotune-device.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-blkiotune-device.xml
@@ -30,6 +30,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-blkiotune.xml b/tests/qemuxml2argvdata/qemuxml2argv-blkiotune.xml
index 4fa03ef..ae7133f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-blkiotune.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-blkiotune.xml
@@ -22,6 +22,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml
index 14ccd23..183894b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml
@@ -20,6 +20,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-complex-bootindex.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-complex-bootindex.xml
index b4d6f4f..860f52e 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-complex-bootindex.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-complex-bootindex.xml
@@ -50,6 +50,7 @@
<target dev='fda' bus='fdc'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='fdc' index='0'/>
<controller type='ide' index='0'/>
<interface type='user'>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-complex.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-complex.xml
index b4d6f4f..860f52e 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-complex.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-complex.xml
@@ -50,6 +50,7 @@
<target dev='fda' bus='fdc'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='fdc' index='0'/>
<controller type='ide' index='0'/>
<interface type='user'>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.xml
index db3a94f..ff20736 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.xml
@@ -24,6 +24,7 @@
<target dev='fda' bus='fdc'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='fdc' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-drive-bootindex.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-drive-bootindex.xml
index bc1da8a..66a64df 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-drive-bootindex.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-drive-bootindex.xml
@@ -21,6 +21,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-drive.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-drive.xml
index bc1da8a..66a64df 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-drive.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-drive.xml
@@ -21,6 +21,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable.xml
index bc1da8a..66a64df 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable.xml
@@ -21,6 +21,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable.xml
index c35b2bd..d92f681 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable.xml
@@ -21,6 +21,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-multi.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-multi.xml
index 44ca0fa..09556da 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-multi.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-multi.xml
@@ -24,6 +24,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-network.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-network.xml
index d3f3369..aec0796 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-network.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-network.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-order.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-order.xml
index 68741fe..f46ef5c 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-order.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-order.xml
@@ -40,6 +40,7 @@
<boot order='4'/>
<address type='drive' controller='0' bus='0' unit='1'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='fdc' index='0'/>
<interface type='user'>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-bootloader.xml b/tests/qemuxml2argvdata/qemuxml2argv-bootloader.xml
index 6ce846d..332e6b6 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-bootloader.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-bootloader.xml
@@ -20,6 +20,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-guestfwd.xml b/tests/qemuxml2argvdata/qemuxml2argv-channel-guestfwd.xml
index b1d5281..1016ead 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-channel-guestfwd.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-guestfwd.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<channel type='pipe'>
<source path='/tmp/guestfwd'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc-old.xml b/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc-old.xml
index 0e82394..9b53469 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc-old.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc-old.xml
@@ -18,6 +18,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='virtio-serial' index='1'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.xml b/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.xml
index 0e82394..9b53469 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.xml
@@ -18,6 +18,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='virtio-serial' index='1'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-auto.xml b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-auto.xml
index c127d84..dd3bd9d 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-auto.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-auto.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='virtio-serial' index='0' ports='16' vectors='4'/>
<controller type='virtio-serial' index='1'>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.xml b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.xml
index f612c02..e13f8b9 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='virtio-serial' index='1'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-clock-france.xml b/tests/qemuxml2argvdata/qemuxml2argv-clock-france.xml
index 017ef39..60560ee 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-clock-france.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-clock-france.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.xml b/tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.xml
index ed746c1..958b3d2 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-clock-localtime.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-clock-utc.xml b/tests/qemuxml2argvdata/qemuxml2argv-clock-utc.xml
index 479a1d9..317f793 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-clock-utc.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-clock-utc.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-clock-variable.xml b/tests/qemuxml2argvdata/qemuxml2argv-clock-variable.xml
index 9f52cca..eea6ce4 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-clock-variable.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-clock-variable.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-auto.xml b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-auto.xml
index bd19988..7fb2ff9 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-auto.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-auto.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<console type='pty'>
<target port='0'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-chardev.xml b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-chardev.xml
index 0bf52f4..1a7899a 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-chardev.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-chardev.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='pty'>
<target port='0'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-compat.xml b/tests/qemuxml2argvdata/qemuxml2argv-console-compat.xml
index 9011522..f579b11 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-console-compat.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-console-compat.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='pty'>
<target port='0'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.xml b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.xml
index e65fb74..71b7fbe 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='virtio-serial' index='0'/>
<serial type='pty'>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-virtio.xml b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio.xml
index 259af4a..8311e59 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-console-virtio.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<console type='pty'>
<target type='virtio'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-kvmclock.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-kvmclock.xml
index 15a9e44..50f582b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-kvmclock.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-kvmclock.xml
@@ -18,6 +18,7 @@
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
+ <controller type='usb' index='0'/>
<memballoon model='virtio'/>
</devices>
</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-kvmclock.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-kvmclock.xml
index 2b51b0e..63a6163 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-kvmclock.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-kvmclock.xml
@@ -19,6 +19,7 @@
<on_crash>destroy</on_crash>
<devices>
<emulator>/./qemu.sh</emulator>
+ <controller type='usb' index='0'/>
<memballoon model='virtio'/>
</devices>
</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cputune.xml b/tests/qemuxml2argvdata/qemuxml2argv-cputune.xml
index 091865a..b892320 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cputune.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cputune.xml
@@ -26,6 +26,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-aio.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-aio.xml
index f6d7633..12b114f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-aio.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-aio.xml
@@ -27,6 +27,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-empty.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-empty.xml
index bc40d16..565b8e2 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-empty.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-empty.xml
@@ -24,6 +24,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.xml
index 2fd2e6a..cea3f4a 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.xml
@@ -25,6 +25,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.xml
index 433c641..a94623a 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.xml
@@ -32,6 +32,7 @@
<model type='virtio'/>
<driver name='vhost' txmode='iothread'/>
</interface>
+ <controller type='usb' index='0'/>
<controller type='virtio-serial' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</controller>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.xml
index 434cd7e..a018655 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.xml
@@ -24,6 +24,7 @@
<target dev='hdc' bus='ide'/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.xml
index 452cb82..ba27ec6 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.xml
@@ -24,6 +24,7 @@
<target dev='hdc' bus='ide'/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-directsync.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-directsync.xml
index 17d7c1c..1996223 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-directsync.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-directsync.xml
@@ -27,6 +27,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-unsafe.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-unsafe.xml
index 37185f6..562ff0a 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-unsafe.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-unsafe.xml
@@ -27,6 +27,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-none.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-none.xml
index 3f60871..2d954de 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-none.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-none.xml
@@ -27,6 +27,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wb.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wb.xml
index 6a4e8e3..adb243d 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wb.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wb.xml
@@ -27,6 +27,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wt.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wt.xml
index 5f351f5..0c50f48 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wt.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wt.xml
@@ -27,6 +27,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-none.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-none.xml
index da07d5e..fcf52a4 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-none.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-none.xml
@@ -27,6 +27,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wb.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wb.xml
index 8c30aec..5445be6 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wb.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wb.xml
@@ -27,6 +27,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wt.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wt.xml
index a9e0c33..de543a9 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wt.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wt.xml
@@ -27,6 +27,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-enospace.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-enospace.xml
index f9a56ab..694c59b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-enospace.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-enospace.xml
@@ -27,6 +27,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-stop.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-stop.xml
index 6d99607..34fe20f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-stop.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-stop.xml
@@ -27,6 +27,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-wreport-rignore.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-wreport-rignore.xml
index 70068aa..80cf5fe 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-wreport-rignore.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-wreport-rignore.xml
@@ -27,6 +27,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.xml
index d473711..fdf2030 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.xml
@@ -21,6 +21,7 @@
<readonly/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml
index cc88ef5..dbece24 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml
@@ -27,6 +27,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd.xml
index c0255a8..7ba0ab0 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd.xml
@@ -26,6 +26,7 @@
</source>
<target dev='vda' bus='virtio'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth.xml
index 88f7f7a..a81bf1a 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth.xml
@@ -31,6 +31,7 @@
</source>
<target dev='vda' bus='virtio'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-ceph-env.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-ceph-env.xml
index e920db1..f0bcfd5 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-ceph-env.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-ceph-env.xml
@@ -28,6 +28,7 @@
</source>
<target dev='vda' bus='virtio'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd.xml
index e920db1..f0bcfd5 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd.xml
@@ -28,6 +28,7 @@
</source>
<target dev='vda' bus='virtio'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-sheepdog.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-sheepdog.xml
index 83d6c4e..cd0eef4 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-sheepdog.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-sheepdog.xml
@@ -26,6 +26,7 @@
</source>
<target dev='vda' bus='virtio'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-no-boot.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-no-boot.xml
index a7e08fd..88ce751 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-no-boot.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-no-boot.xml
@@ -31,6 +31,7 @@
<target dev='fda' bus='fdc'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='fdc' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='none'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-readonly-disk.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-readonly-disk.xml
index c0cf6a4..380f850 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-readonly-disk.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-readonly-disk.xml
@@ -25,6 +25,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-readonly-no-device.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-readonly-no-device.xml
index c0cf6a4..380f850 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-readonly-no-device.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-readonly-no-device.xml
@@ -25,6 +25,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.xml
index 8dcf4b7..c155040 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.xml
@@ -29,6 +29,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.xml
index 6c2a18d..99adcd4 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.xml
@@ -29,6 +29,7 @@
<target dev='fdb' bus='fdc'/>
<address type='drive' controller='0' bus='0' unit='1'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='fdc' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-ioeventfd.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-ioeventfd.xml
index c565c9f..3bc82cb 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-ioeventfd.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-ioeventfd.xml
@@ -32,6 +32,7 @@
<model type='virtio'/>
<driver name='vhost' txmode='iothread' ioeventfd='off'/>
</interface>
+ <controller type='usb' index='0'/>
<controller type='virtio-serial' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</controller>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-many.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-many.xml
index 3b28a34..c04d6e2 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-many.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-many.xml
@@ -34,6 +34,7 @@
<target dev='hdd' bus='ide'/>
<address type='drive' controller='0' bus='1' unit='1'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-order.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-order.xml
index b07bbed..d89e57b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-order.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-order.xml
@@ -31,6 +31,7 @@
<source file='/tmp/data.img'/>
<target dev='vda' bus='virtio'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-sata-device.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-sata-device.xml
index 68a14f2..81f30e5 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-sata-device.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-sata-device.xml
@@ -19,6 +19,7 @@
<target dev='sda' bus='sata'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='sata' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device-auto.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device-auto.xml
index a7e55b0..fbbf6ed 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device-auto.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device-auto.xml
@@ -18,6 +18,7 @@
<source dev='/dev/HostVG/QEMUGuest1'/>
<target dev='hda' bus='ide'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<disk type='file' device='disk'>
<source file='/tmp/scsidisk.img'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device.xml
index 530c0a6..17b59d8 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-device.xml
@@ -24,6 +24,7 @@
<target dev='sda' bus='scsi'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='scsi' index='0'/>
<memballoon model='virtio'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-virtio-scsi.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-virtio-scsi.xml
index 452ade8..3c61e1f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-virtio-scsi.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-virtio-scsi.xml
@@ -24,6 +24,7 @@
<target dev='sda' bus='scsi'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='scsi' index='0' model='virtio-scsi'/>
<memballoon model='virtio'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-vscsi.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-vscsi.xml
index 7cf5798..12f928a 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-vscsi.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-vscsi.xml
@@ -24,6 +24,7 @@
<target dev='sda' bus='scsi'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='scsi' index='0' model='ibmvscsi'/>
<memballoon model='virtio'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.xml
index aeb2315..2501ac8 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.xml
@@ -33,6 +33,7 @@
<target dev='hdb' bus='ide'/>
<address type='drive' controller='0' bus='2' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-transient.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-transient.xml
index df49c48..e5aef0a 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-transient.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-transient.xml
@@ -21,6 +21,7 @@
<transient/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-usb.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-usb.xml
index 0a9adef..a8a505d 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-usb.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-usb.xml
@@ -23,6 +23,7 @@
<source file='/tmp/usbdisk.img'/>
<target dev='sda' bus='usb'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio.xml
index eef9a1b..9a9e966 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio.xml
@@ -33,6 +33,7 @@
<source file='/tmp/logs.img'/>
<target dev='vdb' bus='virtio'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-xenvbd.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-xenvbd.xml
index c940847..4497a04 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-xenvbd.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-xenvbd.xml
@@ -33,6 +33,7 @@
<source file='/tmp/logs.img'/>
<target dev='xvdg' bus='xen'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-encrypted-disk.xml b/tests/qemuxml2argvdata/qemuxml2argv-encrypted-disk.xml
index fdcf624..636f7e4 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-encrypted-disk.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-encrypted-disk.xml
@@ -23,6 +23,7 @@
</encryption>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
+ <controller type='usb' index='0'/>
<memballoon model='virtio'/>
</devices>
</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-event_idx.xml b/tests/qemuxml2argvdata/qemuxml2argv-event_idx.xml
index 81f2200..6dc346d 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-event_idx.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-event_idx.xml
@@ -29,6 +29,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='virtio-serial' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</controller>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml b/tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml
index ceee0b8..4d6ebd7 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml
@@ -21,6 +21,7 @@
<readonly/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='fdc' index='0'/>
<memballoon model='virtio'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-fs9p.xml b/tests/qemuxml2argvdata/qemuxml2argv-fs9p.xml
index e31db48..c187995 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-fs9p.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-fs9p.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<filesystem type='mount'>
<source dir='/export/to/guest'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network.xml
index a49e5d3..c341054 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='5903' autoport='no'>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network2.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network2.xml
index 1c55eff..7985625 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network2.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network2.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' listen='1.2.3.4' autoport='yes'>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml
index 4e11a28..277c1d4 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<input type='mouse' bus='ps2'/>
<graphics type='sdl' display=':0.1' xauth='/root/.Xauthority' fullscreen='yes'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml
index cf5aaa9..a5a169a 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<input type='mouse' bus='ps2'/>
<graphics type='sdl' display=':0.1' xauth='/root/.Xauthority'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml
index d92211c..33e2190 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<input type='mouse' bus='ps2'/>
<graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1'>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml
index 65fc2d9..ac1a915 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<input type='mouse' bus='ps2'/>
<graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1'>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
index 5313b3a..d4e68e4 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<input type='mouse' bus='ps2'/>
<graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1'>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml
index 1f6c115..339b1fd 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml
index 19c9213..e3151e5 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' socket='/tmp/foo.socket'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml
index 1f6c115..339b1fd 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml
index f93facc..ad2bfc0 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='5903' autoport='no' listen='2001:1:2:3:4:5:1234:1234'>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-address.xml b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-address.xml
index a88ada4..a7f0410 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-address.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-address.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<hostdev mode='subsystem' type='pci' managed='yes'>
<source>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.xml b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.xml
index c224291..80b4771 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<hostdev mode='subsystem' type='usb' managed='no'>
<source>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages.xml b/tests/qemuxml2argvdata/qemuxml2argv-hugepages.xml
index 78bf4e1..fa0bb96 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-hugepages.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages.xml
@@ -22,6 +22,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse-addr.xml b/tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse-addr.xml
index a2fa8e3..858b385 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse-addr.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse-addr.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<input type='mouse' bus='usb'>
<address type='usb' bus='0' port='4'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.xml b/tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.xml
index b9aff61..cc78f9f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<input type='mouse' bus='usb'/>
<memballoon model='virtio'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.xml b/tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.xml
index 18d5cb5..c042ed2 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-input-usbtablet.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<input type='tablet' bus='usb'/>
<memballoon model='virtio'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-input-xen.xml b/tests/qemuxml2argvdata/qemuxml2argv-input-xen.xml
index fb42c95..0b82b3b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-input-xen.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-input-xen.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-kvmclock.xml b/tests/qemuxml2argvdata/qemuxml2argv-kvmclock.xml
index 6ff3b35..fbd31ec 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-kvmclock.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-kvmclock.xml
@@ -16,6 +16,7 @@
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/kvm</emulator>
+ <controller type='usb' index='0'/>
<memballoon model='virtio'/>
</devices>
</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-lease.xml b/tests/qemuxml2argvdata/qemuxml2argv-lease.xml
index 7efe1ef..b998f62 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-lease.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-lease.xml
@@ -25,6 +25,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<lease>
<lockspace>somearea</lockspace>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-memtune.xml b/tests/qemuxml2argvdata/qemuxml2argv-memtune.xml
index 37b5c88..c81a253 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-memtune.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-memtune.xml
@@ -24,6 +24,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-migrate.xml b/tests/qemuxml2argvdata/qemuxml2argv-migrate.xml
index 99e81ae..e16fce5 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-migrate.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-migrate.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-minimal.xml b/tests/qemuxml2argvdata/qemuxml2argv-minimal.xml
index 51eb59a..d060271 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-minimal.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-minimal.xml
@@ -24,6 +24,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.xml b/tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.xml
index d5f8d2f..a4fce92 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.xml
@@ -22,6 +22,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.xml b/tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.xml
index b06493f..b84a0b4 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-misc-no-reboot.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-misc-uuid.xml b/tests/qemuxml2argvdata/qemuxml2argv-misc-uuid.xml
index d5f8d2f..a4fce92 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-misc-uuid.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-misc-uuid.xml
@@ -22,6 +22,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-monitor-json.xml b/tests/qemuxml2argvdata/qemuxml2argv-monitor-json.xml
index 1901715..6760304 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-monitor-json.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-monitor-json.xml
@@ -19,6 +19,7 @@
<source file='/dev/hda1'/>
<target dev='hda'/>
</disk>
+ <controller type='usb' index='0'/>
<memballoon model='virtio'/>
</devices>
</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml
index 852c97b..d5e4b9a 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml
@@ -34,6 +34,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-eth-ifname.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-eth-ifname.xml
index a638e06..bd5a153 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-eth-ifname.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-eth-ifname.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<interface type='ethernet'>
<mac address='00:11:22:33:44:55'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-eth.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-eth.xml
index d5c4b36..61836be 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-eth.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-eth.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<interface type='ethernet'>
<mac address='00:11:22:33:44:55'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-user.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-user.xml
index 540808d..4a6f041 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-user.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-user.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-device.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-device.xml
index 4e7abcd..013c444 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-device.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-device.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev.xml
index 5f2b12c..2e46562 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev.xml
@@ -18,6 +18,7 @@
<source dev='/dev/HostVG/QEMUGuest1'/>
<target dev='hda' bus='ide'/>
</disk>
+ <controller type='usb' index='0'/>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
<model type='virtio'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-network-portgroup.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-network-portgroup.xml
index 0f6e076..4a56f59 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-network-portgroup.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-network-portgroup.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<interface type='network'>
<mac address='00:11:22:33:44:55'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio.xml
index ec930b3..f17b5a9 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.xml b/tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.xml
index 99e81ae..e16fce5 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml b/tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml
index 5c50ecc..67cf661 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<parallel type='tcp'>
<source mode='bind' host='127.0.0.1' service='9999'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pci-rom.xml b/tests/qemuxml2argvdata/qemuxml2argv-pci-rom.xml
index 731a69d..51eecbc 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-pci-rom.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pci-rom.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<interface type='user'>
<mac address='52:54:00:24:a5:9f'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-qemu-ns-no-env.xml b/tests/qemuxml2argvdata/qemuxml2argv-qemu-ns-no-env.xml
index 0d9dd98..9bf8da7 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-qemu-ns-no-env.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-qemu-ns-no-env.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-restore-v1.xml b/tests/qemuxml2argvdata/qemuxml2argv-restore-v1.xml
index 479a1d9..317f793 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-restore-v1.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-restore-v1.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-restore-v2-fd.xml b/tests/qemuxml2argvdata/qemuxml2argv-restore-v2-fd.xml
index 99e81ae..e16fce5 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-restore-v2-fd.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-restore-v2-fd.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-restore-v2.xml b/tests/qemuxml2argvdata/qemuxml2argv-restore-v2.xml
index 99e81ae..e16fce5 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-restore-v2.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-restore-v2.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-seclabel-dynamic-baselabel.xml b/tests/qemuxml2argvdata/qemuxml2argv-seclabel-dynamic-baselabel.xml
index fea0eb7..dfbdf9e 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-seclabel-dynamic-baselabel.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-seclabel-dynamic-baselabel.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-seclabel-dynamic-override.xml b/tests/qemuxml2argvdata/qemuxml2argv-seclabel-dynamic-override.xml
index 19b1cbb..c34243b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-seclabel-dynamic-override.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-seclabel-dynamic-override.xml
@@ -31,6 +31,7 @@
<readonly/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-seclabel-none.xml b/tests/qemuxml2argvdata/qemuxml2argv-seclabel-none.xml
index 1ef97ce..7b48206 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-seclabel-none.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-seclabel-none.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-seclabel-static.xml b/tests/qemuxml2argvdata/qemuxml2argv-seclabel-static.xml
index 416bd86..2a8dd5b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-seclabel-static.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-seclabel-static.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-dev-chardev.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-dev-chardev.xml
index ea5a3f8..b6f9d29 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-dev-chardev.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-dev-chardev.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='dev'>
<source path='/dev/ttyS2'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-dev.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-dev.xml
index 41f473a..56f9006 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-dev.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-dev.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='dev'>
<source path='/dev/ttyS2'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-file-chardev.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-file-chardev.xml
index 9a3e197..c64da73 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-file-chardev.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-file-chardev.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='file'>
<source path='/tmp/serial.log'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-file.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-file.xml
index 975d81e..54bfc93 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-file.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-file.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='file'>
<source path='/tmp/serial.log'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-many-chardev.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-many-chardev.xml
index d6116e8..29e12be 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-many-chardev.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-many-chardev.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='pty'>
<target port='0'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-many.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-many.xml
index e68ad79..371fc44 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-many.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-many.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='pty'>
<target port='0'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-pty-chardev.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-pty-chardev.xml
index 57d1b74..17fc702 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-pty-chardev.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-pty-chardev.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='pty'>
<target port='0'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-pty.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-pty.xml
index 19dd131..7e2ca30 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-pty.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-pty.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='pty'>
<target port='0'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-chardev.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-chardev.xml
index cd43384..2b1f5d4 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-chardev.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-chardev.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='tcp'>
<source mode='connect' host='127.0.0.1' service='9999'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet-chardev.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet-chardev.xml
index 14bead4..1cebeff 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet-chardev.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet-chardev.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='tcp'>
<source mode='bind' host='127.0.0.1' service='9999'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.xml
index ad5a038..3b8dca8 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='tcp'>
<source mode='bind' host='127.0.0.1' service='9999'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.xml
index 45ad585..fe19f8b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='tcp'>
<source mode='connect' host='127.0.0.1' service='9999'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-udp-chardev.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-udp-chardev.xml
index 9627c67..52ccc94 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-udp-chardev.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-udp-chardev.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='udp'>
<source mode='bind' host='127.0.0.1' service='9999'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml
index f606ea4..31c9104 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='udp'>
<source mode='bind' host='127.0.0.1' service='9999'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-unix-chardev.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-unix-chardev.xml
index 4ed72aa..e86c1ae 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-unix-chardev.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-unix-chardev.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='unix'>
<source mode='connect' path='/tmp/serial.sock'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-unix.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-unix.xml
index 4685ad4..053cec1 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-unix.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-unix.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='unix'>
<source mode='connect' path='/tmp/serial.sock'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-vc.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-vc.xml
index 6100332..c086092 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-vc.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-vc.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='vc'>
<target port='0'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smp.xml b/tests/qemuxml2argvdata/qemuxml2argv-smp.xml
index cba15dc..9d0d918 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-smp.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-smp.xml
@@ -22,6 +22,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-sound.xml b/tests/qemuxml2argvdata/qemuxml2argv-sound.xml
index 57cabb4..e5b3f13 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-sound.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-sound.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<sound model='pcspk'/>
<sound model='es1370'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-lun.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-lun.xml
index 63107d5..1b183aa 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-lun.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-lun.xml
@@ -28,6 +28,7 @@
<target dev='vdb' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='virtio-serial' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</controller>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-watchdog.xml b/tests/qemuxml2argvdata/qemuxml2argv-watchdog.xml
index 06da70b..e1f6e56 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-watchdog.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-watchdog.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<watchdog model='ib700' action='poweroff'/>
<memballoon model='virtio'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml
index 479a1d9..317f793 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml
index a52ea8e..1602b6c 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='virtio-serial' index='0' ports='16' vectors='4'/>
<controller type='virtio-serial' index='1'>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml
index 9011522..f579b11 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<serial type='pty'>
<target port='0'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml
index b64c7e5..f1f70c7 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='virtio-serial' index='0'/>
<console type='pty'>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-cdrom-empty.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-cdrom-empty.xml
index 9299da3..897b0d2 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-cdrom-empty.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-cdrom-empty.xml
@@ -25,6 +25,7 @@
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml
index 530c0a6..17b59d8 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml
@@ -24,6 +24,7 @@
<target dev='sda' bus='scsi'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='scsi' index='0'/>
<memballoon model='virtio'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml
index d369b89..188e14a 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml
@@ -19,6 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='1.2.3.4'>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml
index ac72822..53298d1 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml
@@ -58,6 +58,7 @@
<controller type='virtio-serial' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</controller>
+ <controller type='usb' index='0'/>
<interface type='ethernet'>
<mac address='52:54:00:71:70:89'/>
<script path='/etc/qemu-ifup'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml
index a029404..01b820d 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml
@@ -24,6 +24,7 @@
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<controller type='ide' index='0'/>
+ <controller type='usb' index='0'/>
<memballoon model='virtio'/>
</devices>
</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml
index 878418a..44472c7 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml
@@ -20,6 +20,7 @@
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<controller type='ide' index='0'/>
+ <controller type='usb' index='0'/>
<serial type='pty'>
<target port='0'/>
</serial>
--
1.7.7.6
12 years, 9 months
[libvirt] [PATCH] Cleanup of the quick dirty fix from last week
by Martin Kletzander
I tried lots of different solutions and this seems like the most clean
and readable one.
---
src/lxc/lxc_container.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index e93fda5..c55f264 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -449,8 +449,6 @@ static int lxcContainerMountBasicFS(const char *srcprefix, bool pivotRoot)
char *opts = NULL;
#if HAVE_SELINUX
security_context_t con;
-#else
- bool con = false;
#endif
VIR_DEBUG("Mounting basic filesystems %s pivotRoot=%d", NULLSTR(srcprefix), pivotRoot);
@@ -511,10 +509,14 @@ static int lxcContainerMountBasicFS(const char *srcprefix, bool pivotRoot)
* tmpfs is limited to 64kb, since we only have device nodes in there
* and don't want to DOS the entire OS RAM usage
*/
+#if HAVE_SELINUX
if (virAsprintf(&opts, "mode=755,size=65536%s%s%s",
con ? ",context=\"" : "",
con ? (const char *)con : "",
con ? "\"" : "") < 0) {
+#else
+ if (virAsprintf(&opts, "mode=755,size=65536") < 0) {
+#endif
virReportOOMError();
goto cleanup;
}
--
1.7.3.4
12 years, 9 months
[libvirt] [PATCHv2] python: Expose virDomain{G, S}etInterfaceParameters' APIs in python binding
by ajia@redhat.com
From: Alex Jia <ajia(a)redhat.com>
The v2 patch to follow latest python binding codes change.
An simple example to show how to use it:
#!/usr/bin/env python
import libvirt
conn = libvirt.open(None)
dom = conn.lookupByName('foo')
print dom.interfaceParameters('vnet0', 0)
params = {'outbound.peak': 10,
'inbound.peak': 10,
'inbound.burst': 20,
'inbound.average': 20,
'outbound.average': 30,
'outbound.burst': 30}
print dom.setInterfaceParameters('vnet0', params, 0)
print dom.interfaceParameters('vnet0', 0)
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
python/libvirt-override-api.xml | 16 +++++
python/libvirt-override.c | 125 +++++++++++++++++++++++++++++++++++++++
2 files changed, 141 insertions(+), 0 deletions(-)
diff --git a/python/libvirt-override-api.xml b/python/libvirt-override-api.xml
index 8eed0bb..2802e19 100644
--- a/python/libvirt-override-api.xml
+++ b/python/libvirt-override-api.xml
@@ -261,6 +261,22 @@
<arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
<arg name='flags' type='int' info='an OR'ed set of virDomainModificationImpact'/>
</function>
+ <function name='virDomainSetInterfaceParameters' file='python'>
+ <info>Change the bandwidth tunables for a interface device</info>
+ <arg name='dom' type='virDomainPtr' info='pointer to the domain'/>
+ <arg name='device' type='const char *' info='interface name'/>
+ <arg name='params' type='virTypedParameterPtr' info='Pointer to bandwidth tuning params object'/>
+ <arg name='flags' type='unsigned int' info='an OR'ed set of virDomainModificationImpact'/>
+ <return type='int' info='0 in case of success, -1 in case of failure'/>
+ </function>
+ <function name='virDomainGetInterfaceParameters' file='python'>
+ <info>Get the bandwidth tunables for a interface device</info>
+ <arg name='dom' type='virDomainPtr' info='pointer to the domain'/>
+ <arg name='device' type='const char *' info='interface name'/>
+ <arg name='flags' type='unsigned int' info='an OR'ed set of virDomainModificationImpact'/>
+ <return type='virTypedParameterPtr' info='the bandwidth tunables value or None in case of error'/>
+ </function>
+
<function name='virConnectListStoragePools' file='python'>
<info>list the storage pools, stores the pointers to the names in @names</info>
<arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/>
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index e7c2bd5..6806057 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -1356,6 +1356,129 @@ cleanup:
}
static PyObject *
+libvirt_virDomainSetInterfaceParameters(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ virDomainPtr domain;
+ PyObject *pyobj_domain, *info;
+ PyObject *ret = NULL;
+ int i_retval;
+ int nparams = 0, size = 0;
+ unsigned int flags;
+ const char *device = NULL;
+ virTypedParameterPtr params, new_params;
+
+ if (!PyArg_ParseTuple(args,
+ (char *)"OzOi:virDomainSetInterfaceParameters",
+ &pyobj_domain, &device, &info, &flags))
+ return NULL;
+ domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+
+ if ((size = PyDict_Size(info)) < 0)
+ return NULL;
+
+ if (size == 0) {
+ PyErr_Format(PyExc_LookupError,
+ "Need non-empty dictionary to set attributes");
+ return NULL;
+ }
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ i_retval = virDomainGetInterfaceParameters(domain, device, NULL, &nparams, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (i_retval < 0)
+ return VIR_PY_INT_FAIL;
+
+ if (nparams == 0) {
+ PyErr_Format(PyExc_LookupError,
+ "Domain has no settable attributes");
+ return NULL;
+ }
+
+ if (VIR_ALLOC_N(params, nparams) < 0)
+ return PyErr_NoMemory();
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ i_retval = virDomainGetInterfaceParameters(domain, device, params, &nparams, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (i_retval < 0) {
+ ret = VIR_PY_INT_FAIL;
+ goto cleanup;
+ }
+
+ new_params = setPyVirTypedParameter(info, params, nparams);
+ if (!new_params)
+ goto cleanup;
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ i_retval = virDomainSetInterfaceParameters(domain, device, new_params, size, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (i_retval < 0) {
+ ret = VIR_PY_INT_FAIL;
+ goto cleanup;
+ }
+
+ ret = VIR_PY_INT_SUCCESS;
+
+cleanup:
+ virTypedParameterArrayClear(params, nparams);
+ VIR_FREE(params);
+ VIR_FREE(new_params);
+ return ret;
+}
+
+static PyObject *
+libvirt_virDomainGetInterfaceParameters(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ virDomainPtr domain;
+ PyObject *pyobj_domain;
+ PyObject *ret = NULL;
+ int i_retval;
+ int nparams = 0;
+ unsigned int flags;
+ const char *device = NULL;
+ virTypedParameterPtr params;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozi:virDomainGetInterfaceParameters",
+ &pyobj_domain, &device, &flags))
+ return NULL;
+ domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ i_retval = virDomainGetInterfaceParameters(domain, device, NULL, &nparams, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (i_retval < 0)
+ return VIR_PY_NONE;
+
+ if (!nparams)
+ return PyDict_New();
+
+ if (VIR_ALLOC_N(params, nparams) < 0)
+ return PyErr_NoMemory();
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ i_retval = virDomainGetInterfaceParameters(domain, device, params, &nparams, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (i_retval < 0) {
+ ret = VIR_PY_NONE;
+ goto cleanup;
+ }
+
+ ret = getPyVirTypedParameter(params, nparams);
+
+cleanup:
+ virTypedParameterArrayClear(params, nparams);
+ VIR_FREE(params);
+ return ret;
+}
+
+static PyObject *
libvirt_virDomainGetVcpus(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args) {
virDomainPtr domain;
@@ -5556,6 +5679,8 @@ static PyMethodDef libvirtMethods[] = {
{(char *) "virDomainGetMemoryParameters", libvirt_virDomainGetMemoryParameters, METH_VARARGS, NULL},
{(char *) "virDomainSetNumaParameters", libvirt_virDomainSetNumaParameters, METH_VARARGS, NULL},
{(char *) "virDomainGetNumaParameters", libvirt_virDomainGetNumaParameters, METH_VARARGS, NULL},
+ {(char *) "virDomainSetInterfaceParameters", libvirt_virDomainSetInterfaceParameters, METH_VARARGS, NULL},
+ {(char *) "virDomainGetInterfaceParameters", libvirt_virDomainGetInterfaceParameters, METH_VARARGS, NULL},
{(char *) "virDomainGetVcpus", libvirt_virDomainGetVcpus, METH_VARARGS, NULL},
{(char *) "virDomainPinVcpu", libvirt_virDomainPinVcpu, METH_VARARGS, NULL},
{(char *) "virDomainPinVcpuFlags", libvirt_virDomainPinVcpuFlags, METH_VARARGS, NULL},
--
1.7.1
12 years, 9 months
[libvirt] [PATCH] rpc: Plug memory leaks on doRemoteOpen() failure path
by ajia@redhat.com
From: Alex Jia <ajia(a)redhat.com>
Detected by valgrind. Leaks are introduced in commit c1b2264.
* src/remote/remote_driver.c (doRemoteOpen): free client program memory in failure path.
* How to reproduce?
% valgrind -v --leak-check=full virsh -c qemu:
* Actual result
==3969== 40 bytes in 1 blocks are definitely lost in loss record 8 of 28
==3969== at 0x4A04A28: calloc (vg_replace_malloc.c:467)
==3969== by 0x4C89C41: virAlloc (memory.c:101)
==3969== by 0x4D5A236: virNetClientProgramNew (virnetclientprogram.c:60)
==3969== by 0x4D47AB4: doRemoteOpen (remote_driver.c:658)
==3969== by 0x4D49FFF: remoteOpen (remote_driver.c:871)
==3969== by 0x4D13373: do_open (libvirt.c:1196)
==3969== by 0x4D14535: virConnectOpenAuth (libvirt.c:1422)
==3969== by 0x425627: main (virsh.c:18537)
==3969==
==3969== 40 bytes in 1 blocks are definitely lost in loss record 9 of 28
==3969== at 0x4A04A28: calloc (vg_replace_malloc.c:467)
==3969== by 0x4C89C41: virAlloc (memory.c:101)
==3969== by 0x4D5A236: virNetClientProgramNew (virnetclientprogram.c:60)
==3969== by 0x4D47AD7: doRemoteOpen (remote_driver.c:664)
==3969== by 0x4D49FFF: remoteOpen (remote_driver.c:871)
==3969== by 0x4D13373: do_open (libvirt.c:1196)
==3969== by 0x4D14535: virConnectOpenAuth (libvirt.c:1422)
==3969== by 0x425627: main (virsh.c:18537)
==3969==
==3969== LEAK SUMMARY:
==3969== definitely lost: 80 bytes in 2 blocks
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
src/remote/remote_driver.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index e068126..2dacb70 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -753,6 +753,8 @@ doRemoteOpen (virConnectPtr conn,
free_qparam_set (vars);
failed:
+ virNetClientProgramFree(priv->remoteProgram);
+ virNetClientProgramFree(priv->qemuProgram);
virNetClientClose(priv->client);
virNetClientFree(priv->client);
priv->client = NULL;
--
1.7.1
12 years, 9 months
[libvirt] [PATCH][PowerPC] Implement sysinfo for libvirt on PowerPC
by Prerna Saxena
From: Prerna Saxena <prerna(a)linux.vnet.ibm.com>
Date: Tue, 7 Feb 2012 16:55:26 +0530
Subject: [PATCH] Implement sysinfo on PowerPC.
Libvirt on x86 parses 'dmidecode' to gather characteristics of host
system, which are then reflected to libvirt users by virSysinfoRead(),
invoked by 'virsh sysinfo'.
This patch implements it on PowerPC by reading /proc/cpuinfo.
The presently available fields in 'sysinfo' are strongly tied to
dmidecode output fields. This patch attempts to retrofit the
information available in PowerPC to appropriate sysinfo fields. I will
be happy to change the organization of this information to if there
are expected outputs for individual fields. (I couldnt find any
documentation which explained what each sysinfo field was expected
to convey.)
TODOS:
1. Adding Memory DIMM information
2) Firmware (<bios>) details.
3) Expand <processor> tag to have more fields available.
Example output on PowerPC :
virsh # sysinfo
<sysinfo type='smbios'>
<system>
<entry name='version'>PowerNV 8246-L2C</entry>
<entry name='serial'>8246-L2C</entry>
<entry name='family'>PowerNV</entry>
</system>
<processor>
<entry name='socket_destination'>0</entry>
<entry name='type'>POWER7 (raw), altivec supported</entry>
<entry name='version'>2.3 (pvr 003f 0203)</entry>
</processor>
<processor>
<entry name='socket_destination'>4</entry>
<entry name='type'>POWER7 (raw), altivec supported</entry>
<entry name='version'>2.3 (pvr 003f 0203)</entry>
</processor>
......
---
src/util/sysinfo.c | 146 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 144 insertions(+), 2 deletions(-)
diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c
index de3108a..4a2ac63 100644
--- a/src/util/sysinfo.c
+++ b/src/util/sysinfo.c
@@ -44,6 +44,7 @@
__FUNCTION__, __LINE__, __VA_ARGS__)
#define SYSINFO_SMBIOS_DECODER "dmidecode"
+#define CPUINFO "/proc/cpuinfo"
VIR_ENUM_IMPL(virSysinfo, VIR_SYSINFO_LAST,
"smbios");
@@ -113,10 +114,151 @@ void virSysinfoDefFree(virSysinfoDefPtr def)
*
* Returns: a filled up sysinfo structure or NULL in case of error
*/
-#if defined(WIN32) || \
+
+#if defined(__powerpc__)
+static char*
+virSysinfoParseSystem(char *base, virSysinfoDefPtr ret)
+{
+ char *cur, *eol = NULL;
+
+ if ((cur = strstr(base, "platform")) == NULL)
+ return base;
+
+ base = cur;
+ /* Account for format 'platform : XXXX'*/
+ cur = strchr(cur, ':') + 1;
+ eol = strchr(cur, '\n');
+ if ((eol) &&
+ ((ret->system_family = strndup(cur, eol - cur)) == NULL))
+ goto no_memory;
+ virSkipSpaces(&(ret->system_family));
+
+ if ((cur = strstr(base, "model")) != NULL) {
+ cur = strchr(cur, ':') + 1;
+ eol = strchr(cur, '\n');
+ if ((eol) && ((ret->system_serial = strndup(cur, eol - cur)) == NULL))
+ goto no_memory;
+ virSkipSpaces(&(ret->system_serial));
+ }
+
+ if ((cur = strstr(base, "machine")) != NULL) {
+ cur = strchr(cur, ':') + 1;
+ eol = strchr(cur, '\n');
+ if ((eol) && ((ret->system_version = strndup(cur, eol - cur)) == NULL))
+ goto no_memory;
+ virSkipSpaces(&(ret->system_version));
+ }
+
+ ret->system_manufacturer = NULL;
+ ret->system_product = NULL;
+ ret->system_uuid = NULL;
+ ret->system_sku = NULL;
+
+ return cur;
+
+no_memory:
+ return NULL;
+}
+
+static char *
+virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
+{
+ char *cur, *eol, *tmp_base;
+ virSysinfoProcessorDefPtr processor;
+
+ while((tmp_base = strstr(base, "processor")) != NULL) {
+ base = tmp_base;
+ eol = strchr(base, '\n');
+ cur = strchr(base, ':') + 1;
+
+ if (VIR_EXPAND_N(ret->processor, ret->nprocessor, 1) < 0) {
+ goto no_memory;
+ }
+
+ processor = &ret->processor[ret->nprocessor - 1];
+ if ((eol) &&
+ ((processor->processor_socket_destination = strndup(cur, eol - cur)) == NULL))
+ goto no_memory;
+ virSkipSpaces(&(processor->processor_socket_destination));
+
+ if ((cur = strstr(base, "cpu")) != NULL) {
+ cur = strchr(cur, ':') + 1;
+ eol = strchr(cur, '\n');
+ if ((eol) &&
+ ((processor->processor_type = strndup(cur, eol - cur)) == NULL))
+ goto no_memory;
+ virSkipSpaces(&(processor->processor_type));
+ }
+
+ if ((cur = strstr(base, "revision")) != NULL) {
+ cur = strchr(cur, ':') + 1;
+ eol = strchr(cur, '\n');
+ if ((eol) &&
+ ((processor->processor_version = strndup(cur, eol - cur)) == NULL))
+ goto no_memory;
+ virSkipSpaces(&(processor->processor_version));
+ }
+
+ /* Mark non-required fields as 'NULL' */
+ processor->processor_family = NULL;
+ processor->processor_manufacturer = NULL;
+ processor->processor_signature = NULL;
+ processor->processor_external_clock = NULL;
+ processor->processor_max_speed = NULL;
+ processor->processor_status = NULL;
+ processor->processor_serial_number = NULL;
+ processor->processor_part_number = NULL;
+
+ base = cur;
+ }
+
+ return base;
+
+no_memory:
+ return NULL;
+}
+
+/* virSysinfoRead for PowerPC */
+virSysinfoDefPtr
+virSysinfoRead(void) {
+ virSysinfoDefPtr ret = NULL;
+ char *outbuf = NULL;
+
+ if (VIR_ALLOC(ret) < 0)
+ goto no_memory;
+
+ /* mark irrelevant fields as 'NULL' */
+ ret->bios_vendor = NULL;
+ ret->bios_version = NULL;
+ ret->bios_date = NULL;
+ ret->bios_release = NULL;
+
+ if(virFileReadAll(CPUINFO, 2048, &outbuf) < 0) {
+ virSmbiosReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to open %s"),CPUINFO);
+ return NULL;
+ }
+
+ ret->nprocessor = 0;
+ ret->processor = NULL;
+ if (virSysinfoParseProcessor(outbuf, ret) == NULL)
+ goto no_memory;
+
+ if (virSysinfoParseSystem(outbuf, ret) == NULL)
+ goto no_memory;
+
+ return ret;
+
+no_memory:
+ VIR_FREE(outbuf);
+ return NULL;
+}
+
+#elif defined(WIN32) || \
!(defined(__x86_64__) || \
defined(__i386__) || \
- defined(__amd64__))
+ defined(__amd64__) || \
+ defined(__powerpc__))
virSysinfoDefPtr
virSysinfoRead(void) {
/*
--
1.7.7
Awaiting feedback,
--
Prerna Saxena
Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India
12 years, 9 months
[libvirt] [PATCH v4] python: refactoring virTypedParameter conversion for NUMA tuning APIs
by Guannan Ren
*getPyVirTypedParameter
*setPyVirTypedParameter
*virDomainSetNumaParameters
*virDomainGetNumaParameters
---
python/libvirt-override-api.xml | 13 ++
python/libvirt-override.c | 385 +++++++++++++++++++++++++++++++++++++++
2 files changed, 398 insertions(+), 0 deletions(-)
diff --git a/python/libvirt-override-api.xml b/python/libvirt-override-api.xml
index b2b8152..8eed0bb 100644
--- a/python/libvirt-override-api.xml
+++ b/python/libvirt-override-api.xml
@@ -248,6 +248,19 @@
<arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
<arg name='flags' type='int' info='an OR'ed set of virDomainModificationImpact'/>
</function>
+ <function name='virDomainSetNumaParameters' file='python'>
+ <info>Change the NUMA tunables</info>
+ <return type='int' info='-1 in case of error, 0 in case of success.'/>
+ <arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
+ <arg name='params' type='virTypedParameterPtr' info='pointer to numa tunable objects'/>
+ <arg name='flags' type='int' info='an OR'ed set of virDomainModificationImpact'/>
+ </function>
+ <function name='virDomainGetNumaParameters' file='python'>
+ <info>Get the NUMA parameters</info>
+ <return type='str *' info='returns a dictionary of params in case of success, None in case of error'/>
+ <arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
+ <arg name='flags' type='int' info='an OR'ed set of virDomainModificationImpact'/>
+ </function>
<function name='virConnectListStoragePools' file='python'>
<info>list the storage pools, stores the pointers to the names in @names</info>
<arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/>
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 33a841d..3c6020b 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -22,6 +22,7 @@
#include "typewrappers.h"
#include "libvirt.h"
#include "memory.h"
+#include "virtypedparam.h"
#ifndef __CYGWIN__
extern void initlibvirtmod(void);
@@ -62,6 +63,263 @@ static char *py_str(PyObject *obj)
return PyString_AsString(str);
}
+/* Two helper functions to help the conversions between C to Python
+ * for the virTypedParameter used in the following APIs */
+static int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
+getPyVirTypedParameter(PyObject **info,
+ const virTypedParameterPtr params, int nparams)
+{
+ PyObject *key, *val;
+ int i;
+
+ for (i = 0 ; i < nparams ; i++) {
+ switch (params[i].type) {
+ case VIR_TYPED_PARAM_INT:
+ val = PyInt_FromLong((long)params[i].value.i);
+ break;
+
+ case VIR_TYPED_PARAM_UINT:
+ val = PyInt_FromLong((unsigned long)params[i].value.ui);
+ break;
+
+ case VIR_TYPED_PARAM_LLONG:
+ val = PyLong_FromLongLong((long long)params[i].value.l);
+ break;
+
+ case VIR_TYPED_PARAM_ULLONG:
+ val = PyLong_FromUnsignedLongLong((unsigned long long)params[i].value.ul);
+ break;
+
+ case VIR_TYPED_PARAM_DOUBLE:
+ val = PyFloat_FromDouble((double)params[i].value.d);
+ break;
+
+ case VIR_TYPED_PARAM_BOOLEAN:
+ val = PyBool_FromLong((long)params[i].value.b);
+ break;
+
+ case VIR_TYPED_PARAM_STRING:
+ val = libvirt_constcharPtrWrap(params[i].value.s);
+ break;
+
+ default:
+ return 0;
+ }
+
+ key = libvirt_constcharPtrWrap(params[i].field);
+ if (!key || !val)
+ goto cleanup;
+
+ if (PyDict_SetItem(*info, key, val) < 0)
+ goto cleanup;
+
+ Py_DECREF(key);
+ Py_DECREF(val);
+ }
+ return 1;
+cleanup:
+ Py_XDECREF(key);
+ Py_XDECREF(val);
+ return -1;
+}
+
+/* Allocate a new typed parameter array with the same contents and
+ * length as info, and using the array params of length nparams as
+ * hints on what types to use when creating the new array. Return
+ * NULL on failure. */
+static virTypedParameterPtr ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
+setPyVirTypedParameter(PyObject *info,
+ const virTypedParameterPtr params, int nparams)
+{
+ PyObject *key, *value;
+ Py_ssize_t pos = 0;
+ virTypedParameterPtr temp = NULL, ret = NULL;
+ int size, i;
+
+ if ((size = PyDict_Size(info)) < 0)
+ return NULL;
+
+ if (VIR_ALLOC_N(ret, size) < 0) {
+ PyErr_NoMemory();
+ return NULL;
+ }
+
+ temp = &ret[0];
+ while (PyDict_Next(info, &pos, &key, &value)) {
+ char *keystr = NULL;
+ bool found = false;
+
+ if (PyString_Check(key)) {
+ if ((keystr = PyString_AsString(key)) == NULL)
+ goto cleanup;
+ } else {
+ PyErr_Format(PyExc_TypeError,
+ "Attribut name must be string");
+ goto cleanup;
+ }
+
+ for (i = 0; i < nparams; i++) {
+ if (STREQ(params[i].field, keystr)) {
+ found = true;
+ strncpy(temp->field, params[i].field,
+ sizeof(temp->field));
+ temp->type = params[i].type;
+
+ switch(params[i].type) {
+ case VIR_TYPED_PARAM_INT:
+ {
+ long long_val;
+ if (PyInt_Check(value)) {
+ long_val = PyInt_AsLong(value);
+ if ((long_val == -1) && PyErr_Occurred())
+ goto cleanup;
+ } else {
+ PyErr_Format(PyExc_TypeError,
+ "The value type of "
+ "attribute \"%s\" must be int", keystr);
+ goto cleanup;
+ }
+
+ if ((int)long_val == long_val) {
+ temp->value.i = (int)long_val;
+ } else {
+ PyErr_Format(PyExc_ValueError,
+ "The value of "
+ "attribute \"%s\" is out of int range", keystr);
+ goto cleanup;
+ }
+ }
+ break;
+ case VIR_TYPED_PARAM_UINT:
+ {
+ long long_val;
+ if (PyInt_Check(value)) {
+ long_val = PyInt_AsLong(value);
+ if ((long_val == -1) && PyErr_Occurred())
+ goto cleanup;
+ } else {
+ PyErr_Format(PyExc_TypeError,
+ "The value type of "
+ "attribute \"%s\" must be int", keystr);
+ goto cleanup;
+ }
+
+ if ((unsigned int)long_val == long_val) {
+ temp->value.ui = (unsigned int)long_val;
+ } else {
+ PyErr_Format(PyExc_ValueError,
+ "The value of "
+ "attribute \"%s\" is out of int range", keystr);
+ goto cleanup;
+ }
+ }
+ break;
+ case VIR_TYPED_PARAM_LLONG:
+ {
+ long long llong_val;
+ if (PyLong_Check(value)) {
+ llong_val = PyLong_AsLongLong(value);
+ if ((llong_val == -1) && PyErr_Occurred())
+ goto cleanup;
+ } else {
+ PyErr_Format(PyExc_TypeError,
+ "The value type of "
+ "attribute \"%s\" must be long", keystr);
+ goto cleanup;
+ }
+ temp->value.l = llong_val;
+ }
+ break;
+ case VIR_TYPED_PARAM_ULLONG:
+ {
+ unsigned long long ullong_val;
+ if (PyLong_Check(value)) {
+ ullong_val = PyLong_AsUnsignedLongLong(value);
+ if ((ullong_val == -1) && PyErr_Occurred())
+ goto cleanup;
+ } else {
+ PyErr_Format(PyExc_TypeError,
+ "The value type of "
+ "attribute \"%s\" must be long", keystr);
+ goto cleanup;
+
+ }
+ temp->value.ul = ullong_val;
+ }
+ break;
+ case VIR_TYPED_PARAM_DOUBLE:
+ {
+ double double_val;
+ if (PyFloat_Check(value)) {
+ double_val = PyFloat_AsDouble(value);
+ if ((double_val == -1) && PyErr_Occurred())
+ goto cleanup;
+ } else {
+ PyErr_Format(PyExc_TypeError,
+ "The value type of "
+ "attribute \"%s\" must be float", keystr);
+ goto cleanup;
+ }
+ temp->value.d = double_val;
+ }
+ break;
+ case VIR_TYPED_PARAM_BOOLEAN:
+ {
+ /* Hack - Python's definition of Py_True breaks strict
+ * aliasing rules, so can't directly compare
+ */
+ if (PyBool_Check(value)) {
+ PyObject *hacktrue = PyBool_FromLong(1);
+ temp->value.b = hacktrue == value ? 1: 0;
+ Py_DECREF(hacktrue);
+ } else {
+ PyErr_Format(PyExc_TypeError,
+ "The value type of "
+ "attribute \"%s\" must be bool", keystr);
+ goto cleanup;
+ }
+ }
+ break;
+ case VIR_TYPED_PARAM_STRING:
+ {
+ char *string_val;
+ if (PyString_Check(value)) {
+ if ((string_val = PyString_AsString(value)) == NULL)
+ goto cleanup;
+ if ((temp->value.s = strdup(string_val)) == NULL) {
+ PyErr_NoMemory();
+ goto cleanup;
+ }
+ } else {
+ PyErr_Format(PyExc_TypeError,
+ "The value type of "
+ "attribute \"%s\" must be string", keystr);
+ goto cleanup;
+ }
+ }
+ break;
+ default:
+ goto cleanup;
+ }
+ }
+ }
+
+ if (i == nparams && !found) {
+ PyErr_Format(PyExc_LookupError,
+ "Attribute name \"%s\" could not be recognized", keystr);
+ goto cleanup;
+ }
+
+ temp++;
+ }
+ return ret;
+
+cleanup:
+ virTypedParameterArrayClear(ret, size);
+ VIR_FREE(ret);
+ return NULL;
+}
+
/************************************************************************
* *
* Statistics *
@@ -1007,6 +1265,131 @@ libvirt_virDomainGetMemoryParameters(PyObject *self ATTRIBUTE_UNUSED,
}
static PyObject *
+libvirt_virDomainSetNumaParameters(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ virDomainPtr domain;
+ PyObject *pyobj_domain, *info;
+ PyObject *ret = NULL;
+ int i_retval;
+ int nparams = 0, size = 0;
+ unsigned int flags;
+ virTypedParameterPtr params, new_params;
+
+ if (!PyArg_ParseTuple(args,
+ (char *)"OOi:virDomainSetNumaParameters",
+ &pyobj_domain, &info, &flags))
+ return NULL;
+ domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+
+ if ((size = PyDict_Size(info)) < 0)
+ return NULL;
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ i_retval = virDomainGetNumaParameters(domain, NULL, &nparams, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (i_retval < 0 || !nparams)
+ return VIR_PY_INT_FAIL;
+
+ if (VIR_ALLOC_N(params, nparams) < 0)
+ return PyErr_NoMemory();
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ i_retval = virDomainGetNumaParameters(domain, params, &nparams, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (i_retval < 0) {
+ ret = VIR_PY_INT_FAIL;
+ goto cleanup;
+ }
+
+ new_params = setPyVirTypedParameter(info, params, nparams);
+ if (!new_params)
+ goto cleanup;
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ i_retval = virDomainSetNumaParameters(domain, new_params, size, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (i_retval < 0) {
+ ret = VIR_PY_INT_FAIL;
+ goto cleanup;
+ }
+
+ ret = VIR_PY_INT_SUCCESS;
+
+cleanup:
+ virTypedParameterArrayClear(params, nparams);
+ VIR_FREE(params);
+ virTypedParameterArrayClear(new_params, size);
+ VIR_FREE(new_params);
+ return ret;
+}
+
+static PyObject *
+libvirt_virDomainGetNumaParameters(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ virDomainPtr domain;
+ PyObject *pyobj_domain, *info;
+ PyObject *ret = NULL;
+ int i_retval;
+ int nparams = 0;
+ unsigned int flags;
+ virTypedParameterPtr params;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:virDomainGetNumaParameters",
+ &pyobj_domain, &flags))
+ return NULL;
+ domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+
+ if ((info = PyDict_New()) == NULL) {
+ return ret;
+ }
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ i_retval = virDomainGetNumaParameters(domain, NULL, &nparams, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (i_retval < 0)
+ return VIR_PY_NONE;
+
+ if (!nparams)
+ return info;
+
+ if (VIR_ALLOC_N(params, nparams) < 0)
+ return PyErr_NoMemory();
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ i_retval = virDomainGetNumaParameters(domain, params, &nparams, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (i_retval < 0) {
+ ret = VIR_PY_NONE;
+ goto cleanup;
+ }
+
+ i_retval = getPyVirTypedParameter(&info, params, nparams);
+
+ if (i_retval < 0) {
+ Py_XDECREF(info);
+ goto cleanup;
+ } else if (i_retval == 0) {
+ Py_XDECREF(info);
+ ret = VIR_PY_NONE;
+ goto cleanup;
+ } else {
+ ret = info;
+ }
+
+cleanup:
+ virTypedParameterArrayClear(params, nparams);
+ VIR_FREE(params);
+ return ret;
+}
+
+static PyObject *
libvirt_virDomainGetVcpus(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args) {
virDomainPtr domain;
@@ -5203,6 +5586,8 @@ static PyMethodDef libvirtMethods[] = {
{(char *) "virDomainGetBlkioParameters", libvirt_virDomainGetBlkioParameters, METH_VARARGS, NULL},
{(char *) "virDomainSetMemoryParameters", libvirt_virDomainSetMemoryParameters, METH_VARARGS, NULL},
{(char *) "virDomainGetMemoryParameters", libvirt_virDomainGetMemoryParameters, METH_VARARGS, NULL},
+ {(char *) "virDomainSetNumaParameters", libvirt_virDomainSetNumaParameters, METH_VARARGS, NULL},
+ {(char *) "virDomainGetNumaParameters", libvirt_virDomainGetNumaParameters, METH_VARARGS, NULL},
{(char *) "virDomainGetVcpus", libvirt_virDomainGetVcpus, METH_VARARGS, NULL},
{(char *) "virDomainPinVcpu", libvirt_virDomainPinVcpu, METH_VARARGS, NULL},
{(char *) "virDomainPinVcpuFlags", libvirt_virDomainPinVcpuFlags, METH_VARARGS, NULL},
--
1.7.7.5
12 years, 9 months
[libvirt] [PATCH] Remove single quotes from audit records
by Marcelo Cerri
Some audit records generated by libvirt contain fields enclosed by single
quotes. Since those fields are inside the msg field, which is enclosed by
single quotes, these records generated by libvirt are not correctly parsed by
libauparse.
---
src/conf/domain_audit.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index 7d766a2..934e546 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -175,7 +175,7 @@ virDomainAuditNet(virDomainObjPtr vm,
}
VIR_AUDIT(VIR_AUDIT_RECORD_RESOURCE, success,
- "virt=%s resrc=net reason=%s %s uuid=%s old-net='%s' new-net='%s'",
+ "virt=%s resrc=net reason=%s %s uuid=%s old-net=%s new-net=%s",
virt, reason, vmname, uuidstr,
oldDef ? oldMacstr : "?",
newDef ? newMacstr : "?");
@@ -222,7 +222,7 @@ virDomainAuditNetDevice(virDomainDefPtr vmDef, virDomainNetDefPtr netDef,
}
VIR_AUDIT(VIR_AUDIT_RECORD_RESOURCE, success,
- "virt=%s resrc=net reason=open %s uuid=%s net='%s' %s rdev=%s",
+ "virt=%s resrc=net reason=open %s uuid=%s net=%s %s rdev=%s",
virt, vmname, uuidstr, macstr, dev_name, VIR_AUDIT_STR(rdev));
cleanup:
--
1.7.1
12 years, 9 months
Re: [libvirt] [virt-tools-list] Provision through virt-manager not supported on para-virtualized Xen?
by Cole Robinson
On 02/02/2012 08:54 AM, Cheer Xiao wrote:
> 2012/2/2 Cole Robinson <crobinso(a)redhat.com>:
>> On 02/02/2012 08:05 AM, Cheer Xiao wrote:
>>> Hi all,
>>>
>>> I was setting up libvirt and virt-manager for managing Xen VMs. But
>>> when I hit "New" in virt-manager to provision a new VM, virt-manager
>>> gives me the error: "No install options available for this
>>> connection."
>>>
>>> The hypervisor being used is para-virtualized Xen, running on Debian Squeeze.
>>>
>>> lux-002# xm info
>>> host          : lux-002
>>> release         : 2.6.32-5-xen-686
>>> version         : #1 SMP Mon Jan 16 19:46:09 UTC 2012
>>> machine         : i686
>>> nr_cpus         : 4
>>> nr_nodes        : 1
>>> cores_per_socket    : 1
>>> threads_per_core    : 2
>>> cpu_mhz         : 3200
>>> hw_caps         :
>>> bfebfbff:20100000:00000000:00000180:0000641d:00000000:00000001:00000000
>>> virt_caps        :
>>> total_memory      : 8191
>>> free_memory       : 1150
>>> node_to_cpu       : node0:0-3
>>> node_to_memory     : node0:1150
>>> node_to_dma32_mem    : node0:578
>>> max_node_id       : 0
>>> xen_major        : 4
>>> xen_minor        : 0
>>> xen_extra        : .1
>>> xen_caps        : xen-3.0-x86_32p
>>> xen_scheduler      : credit
>>> xen_pagesize      : 4096
>>> platform_params     : virt_start=0xf5800000
>>> xen_changeset      : unavailable
>>> xen_commandline     : placeholder com1=9600,8n1 console=com1,vga
>>> cc_compiler       : gcc version 4.4.5 (Debian 4.4.5-8)
>>> cc_compile_by      : waldi
>>> cc_compile_domain    : debian.org
>>> cc_compile_date     : Mon Nov  7 09:18:26 CET 2011
>>> xend_config_format   : 4
>>> lux-002# libvirtd --version
>>> libvirtd (libvirt) 0.8.3
>>>
>>
>> libvirt pokes into the host machine to try and figure out it's virt
>> capabilities. So something must be going wrong there. Here's the function it
>> uses in libvirt code:
>>
>> http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/xen/xen_hypervisor.c;h...
>>
>> Something must be funky or unexpected with /sys/hypervisor/properties/capabilities
>>
>
> This is how it looks:
>
> lux-002% cat /sys/hypervisor/properties/capabilities
> xen-3.0-x86_32p
>
> So, is provision through on para-virtualized Xen *supposed* to be
> supported or not?
>
That is saying your host supports 32bit paravirt guests only.
What's the output of 'virsh --connect xen:/// capabilities' ?
- Cole
12 years, 9 months
[libvirt] Writing java wrappers to libvirt.java
by Dario Ruiz Lopez
Hello,
I am trying to write a java wrapper that could allow to expand current libvirt support for java to intercept invocations to the driver so new functionality can be added, for instance, automatically sending an accounting log of all libvirt invocations to an external server.
With the current implementation, the central point to do this seemed to be the interface libvirt.java, which defines an interface constant, INSTANCE, which is used all throughout the library to perform the invocations to the driver. My first idea was to create a wrapper for INSTANCE trying to replace it, but, as libvirt.java is an interface, INSTANCE cannot be reinitialized not overloaded. I might still try this by changing libvirt.java to an abstract class and INSTANCE to a static variable, but I do not think that changing the classes of the library is a good idea, especially for maintenance reasons. Does anybody know if there is any other way to define a wrapper for the invocations to the driver?
Best regards,
Darío Ruiz López
------------------------------------------------------------------
This e-mail and the documents attached are confidential and intended
solely for the addressee; it may also be privileged. If you receive
this e-mail in error, please notify the sender immediately and destroy it.
As its integrity cannot be secured on the Internet, the Atos
group liability cannot be triggered for the message content. Although
the sender endeavours to maintain a computer virus-free network,
the sender does not warrant that this transmission is virus-free and
will not be liable for any damages resulting from any virus transmitted.
Este mensaje y los ficheros adjuntos pueden contener informacion confidencial
destinada solamente a la(s) persona(s) mencionadas anteriormente
pueden estar protegidos por secreto profesional.
Si usted recibe este correo electronico por error, gracias por informar
inmediatamente al remitente y destruir el mensaje.
Al no estar asegurada la integridad de este mensaje sobre la red, Atos
no se hace responsable por su contenido. Su contenido no constituye ningun
compromiso para el grupo Atos, salvo ratificacion escrita por ambas partes.
Aunque se esfuerza al maximo por mantener su red libre de virus, el emisor
no puede garantizar nada al respecto y no sera responsable de cualesquiera
danos que puedan resultar de una transmision de virus.
------------------------------------------------------------------
12 years, 9 months