diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2010-01-27 17:03:54 +0000 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2010-02-02 16:31:47 +0000 |
commit | 9258ec0a2e31da1b1a4b815be4bc313464b081a3 (patch) | |
tree | 83189365e1c768a83ccac6ea4504ddba7b55a1f4 /tests | |
parent | Introduce generic virDomainDeviceInfo iterator function (diff) | |
download | libvirt-9258ec0a2e31da1b1a4b815be4bc313464b081a3.tar.gz libvirt-9258ec0a2e31da1b1a4b815be4bc313464b081a3.tar.bz2 libvirt-9258ec0a2e31da1b1a4b815be4bc313464b081a3.zip |
Rewrite way QEMU PCI addresses are allocated
The current QEMU code allocates PCI addresses incrementally starting
at 4. This is not satisfactory because the user may have given some
addresses in their XML config, which need to be skipped over when
allocating addresses to remaining devices.
It is thus neccessary to maintain a list of already allocated PCI
addresses and then only allocate ones that remain unused. This is
also required for domain device hotplug to work properly later.
* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Add APIs for creating
list of existing PCI addresses, and allocating new addresses.
Refactor address assignment to use this code
* src/qemu/qemu_driver.c: Pull PCI address assignment up into the
qemuStartVMDaemon() method, as a prelude to moving it into the
'define' method. Update list of allocated addresses when connecting
to a running VM at daemon startup.
* tests/qemuxml2argvtest.c, tests/qemuargv2xmltest.c,
tests/qemuxml2xmltest.c: Remove USB product test since all
passthrough is done based on address
* tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.args,
tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.xml: Kil
unused data files
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qemuargv2xmltest.c | 1 | ||||
-rw-r--r-- | tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.args | 1 | ||||
-rw-r--r-- | tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.xml | 36 | ||||
-rw-r--r-- | tests/qemuxml2argvtest.c | 13 | ||||
-rw-r--r-- | tests/qemuxml2xmltest.c | 1 |
5 files changed, 12 insertions, 40 deletions
diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c index 8326c5756..1f1914b6a 100644 --- a/tests/qemuargv2xmltest.c +++ b/tests/qemuargv2xmltest.c @@ -213,7 +213,6 @@ mymain(int argc, char **argv) DO_TEST("sound", 0); DO_TEST("watchdog", 0); - DO_TEST("hostdev-usb-product", 0); DO_TEST("hostdev-usb-address", 0); DO_TEST("hostdev-pci-address", QEMUD_CMD_FLAG_PCIDEVICE); diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.args b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.args deleted file mode 100644 index 60847450a..000000000 --- a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.args +++ /dev/null @@ -1 +0,0 @@ -LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -usbdevice host:0204:6025 -usbdevice host:1234:0000 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.xml b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.xml deleted file mode 100644 index 3dc8eeb98..000000000 --- a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.xml +++ /dev/null @@ -1,36 +0,0 @@ -<domain type='qemu'> - <name>QEMUGuest1</name> - <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> - <memory>219200</memory> - <currentMemory>219200</currentMemory> - <vcpu>1</vcpu> - <os> - <type arch='i686' machine='pc'>hvm</type> - <boot dev='hd'/> - </os> - <clock offset='utc'/> - <on_poweroff>destroy</on_poweroff> - <on_reboot>restart</on_reboot> - <on_crash>destroy</on_crash> - <devices> - <emulator>/usr/bin/qemu</emulator> - <disk type='block' device='disk'> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' unit='0'/> - </disk> - <controller type='ide' index='0'/> - <hostdev mode='subsystem' type='usb' managed='no'> - <source> - <vendor id='0x0204'/> - <product id='0x6025'/> - </source> - </hostdev> - <hostdev mode='subsystem' type='usb' managed='no'> - <source> - <vendor id='0x1234'/> - <product id='0x0000'/> - </source> - </hostdev> - </devices> -</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index fc237c212..90c1cb06b 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -62,6 +62,18 @@ static int testCompareXMLToArgvFiles(const char *xml, if (qemudCanonicalizeMachine(&driver, vmdef) < 0) goto fail; + if (flags & QEMUD_CMD_FLAG_DEVICE) { + qemuDomainPCIAddressSetPtr pciaddrs; + if (!(pciaddrs = qemuDomainPCIAddressSetCreate(vmdef))) + goto fail; + + if (qemuAssignDevicePCISlots(vmdef, pciaddrs) < 0) + goto fail; + + qemuDomainPCIAddressSetFree(pciaddrs); + } + + if (qemudBuildCommandLine(NULL, &driver, vmdef, &monitor_chr, 0, flags, &argv, &qenv, @@ -303,7 +315,6 @@ mymain(int argc, char **argv) DO_TEST("sound", 0); DO_TEST("sound-device", QEMUD_CMD_FLAG_DEVICE); - DO_TEST("hostdev-usb-product", 0); DO_TEST("hostdev-usb-address", 0); DO_TEST("hostdev-usb-address-device", QEMUD_CMD_FLAG_DEVICE); DO_TEST("hostdev-pci-address", QEMUD_CMD_FLAG_PCIDEVICE); diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 03026960d..5b706bbaf 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -134,7 +134,6 @@ mymain(int argc, char **argv) DO_TEST("console-compat"); DO_TEST("channel-guestfwd"); - DO_TEST("hostdev-usb-product"); DO_TEST("hostdev-usb-address"); DO_TEST("hostdev-pci-address"); |