qemuDomainAssignPCIAddresses(virDomainDef *def,
virQEMUCaps *qemuCaps,
virQEMUDriver *driver,
- virDomainObj *obj)
+ virDomainObj *obj,
+ bool newDomain)
{
int ret = -1;
virDomainPCIAddressSet *addrs = NULL;
g_clear_pointer(&addrs, virDomainPCIAddressSetFree);
}
- if (!(addrs = qemuDomainPCIAddressSetCreate(def, qemuCaps, nbuses, false)))
- goto cleanup;
+ /* We're done collecting available information, now we're going
+ * to allocate PCI addresses for real. We normally skip this part
+ * for machine type that don't support PCI, but we run it for new
+ * domains to catch situation in which the user is incorrectly
+ * asking for PCI devices to be used. If that's the case, an
+ * error will naturally be raised when attempting to allocate a
+ * PCI address since no PCI buses exist */
+ if (qemuDomainSupportsPCI(def) || newDomain) {
+ if (!(addrs = qemuDomainPCIAddressSetCreate(def, qemuCaps, nbuses, false)))
+ goto cleanup;
- if (qemuDomainSupportsPCI(def)) {
if (qemuDomainValidateDevicePCISlotsChipsets(def, addrs) < 0)
goto cleanup;
qemuDomainAssignVirtioMMIOAddresses(def, qemuCaps);
- if (qemuDomainAssignPCIAddresses(def, qemuCaps, driver, obj) < 0)
+ if (qemuDomainAssignPCIAddresses(def, qemuCaps, driver, obj, newDomain) < 0)
return -1;
if (qemuDomainAssignUSBAddresses(def, obj, newDomain) < 0)
+++ /dev/null
-LC_ALL=C \
-PATH=/bin \
-HOME=/var/lib/libvirt/qemu/domain--1-aarch64test \
-USER=test \
-LOGNAME=test \
-XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.local/share \
-XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.cache \
-XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \
-/usr/bin/qemu-system-aarch64 \
--name guest=aarch64test,debug-threads=on \
--S \
--object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-aarch64test/master-key.aes"}' \
--machine collie,usb=off,dump-guest-core=off,memory-backend=strongarm.sdram \
--accel kvm \
--cpu host \
--m size=1048576k \
--object '{"qom-type":"memory-backend-ram","id":"strongarm.sdram","size":1073741824}' \
--overcommit mem-lock=off \
--smp 1,sockets=1,cores=1,threads=1 \
--uuid 6ba410c5-1e5c-4d57-bee7-2228e7ffa32f \
--display none \
--no-user-config \
--nodefaults \
--chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
--mon chardev=charmonitor,id=monitor,mode=control \
--rtc base=utc \
--no-shutdown \
--boot strict=on \
--device '{"driver":"qemu-xhci","id":"usb"}' \
--audiodev '{"id":"audio1","driver":"none"}' \
--sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
--msg timestamp=on
+++ /dev/null
-<domain type='kvm'>
- <name>aarch64test</name>
- <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
- <memory unit='KiB'>1048576</memory>
- <currentMemory unit='KiB'>1048576</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='aarch64' machine='collie'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='host-passthrough' check='none'/>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-aarch64</emulator>
- <controller type='usb' index='0' model='qemu-xhci'/>
- <audio id='1' type='none'/>
- <memballoon model='none'/>
- </devices>
-</domain>
+++ /dev/null
-usb-controller-default-nousb.xml
\ No newline at end of file
--- /dev/null
+XML error: No PCI buses available
+++ /dev/null
-LC_ALL=C \
-PATH=/bin \
-HOME=/var/lib/libvirt/qemu/domain--1-aarch64test \
-USER=test \
-LOGNAME=test \
-XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.local/share \
-XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.cache \
-XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \
-/usr/bin/qemu-system-aarch64 \
--name guest=aarch64test,debug-threads=on \
--S \
--object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-aarch64test/master-key.aes"}' \
--machine collie,usb=off,dump-guest-core=off,memory-backend=strongarm.sdram \
--accel kvm \
--cpu host \
--m size=1048576k \
--object '{"qom-type":"memory-backend-ram","id":"strongarm.sdram","size":1073741824}' \
--overcommit mem-lock=off \
--smp 1,sockets=1,cores=1,threads=1 \
--uuid 6ba410c5-1e5c-4d57-bee7-2228e7ffa32f \
--display none \
--no-user-config \
--nodefaults \
--chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
--mon chardev=charmonitor,id=monitor,mode=control \
--rtc base=utc \
--no-shutdown \
--boot strict=on \
--device '{"driver":"qemu-xhci","id":"usb"}' \
--audiodev '{"id":"audio1","driver":"none"}' \
--sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
--msg timestamp=on
--- /dev/null
+XML error: No PCI buses available
+++ /dev/null
-internal error: Unable to determine model for USB controller idx=0
+++ /dev/null
-<domain type='kvm'>
- <name>aarch64test</name>
- <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
- <memory unit='KiB'>1048576</memory>
- <currentMemory unit='KiB'>1048576</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='aarch64' machine='collie'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='host-passthrough' check='none'/>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-aarch64</emulator>
- <controller type='usb' index='0'/>
- <audio id='1' type='none'/>
- <memballoon model='none'/>
- </devices>
-</domain>
+++ /dev/null
-usb-controller-default-nousb.xml
\ No newline at end of file
ARG_END);
/* The '-nousb' test case tests machine without a built-in USB controller */
- DO_TEST_CAPS_ARCH_LATEST("usb-controller-default-nousb", "aarch64");
- DO_TEST_FULL("usb-controller-default-fallback-nousb", ".aarch64-latest",
- ARG_CAPS_ARCH, "aarch64",
- ARG_CAPS_VER, "latest",
- ARG_QEMU_CAPS_DEL, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_LAST,
- ARG_END);
- DO_TEST_FULL("usb-controller-default-unavailable-nousb", ".aarch64-latest",
- ARG_CAPS_ARCH, "aarch64",
- ARG_CAPS_VER, "latest",
- ARG_FLAGS, FLAG_EXPECT_FAILURE,
- ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
- ARG_END);
+ DO_TEST_CAPS_ARCH_LATEST_FAILURE("usb-controller-default-nousb", "aarch64");
+ DO_TEST_CAPS_ARCH_LATEST_ABI_UPDATE_PARSE_ERROR("usb-controller-default-nousb", "aarch64");
DO_TEST_FULL("usb-controller-default-fallback-g3beige", ".ppc64-latest",
ARG_CAPS_ARCH, "ppc64",