1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-11 09:17:52 +03:00

Ignore virtio-mmio disks in qemuAssignDevicePCISlots()

Fixes the following error when attempting to add a disk with bus='virtio'
to a machine which actually supports virtio-mmio (caught with ARM virt):

virtio disk cannot have an address of type 'virtio-mmio'

The problem has been likely introduced by
e8d5517254. Before that
qemuAssignDevicePCISlots() was never called for ARM "virt" machine.

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
This commit is contained in:
Pavel Fedin 2015-09-09 15:02:53 +03:00 committed by Martin Kletzander
parent 00e5b96716
commit d526e37bad
2 changed files with 10 additions and 2 deletions

View File

@ -2261,7 +2261,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
virDomainPCIAddressReserveNextSlot(addrs, &info, flags) < 0)
goto cleanup;
if (qemuAssignDevicePCISlots(def, addrs) < 0)
if (qemuAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
goto cleanup;
for (i = 1; i < addrs->nbuses; i++) {
@ -2294,7 +2294,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
if (qemuValidateDevicePCISlotsChipsets(def, qemuCaps, addrs) < 0)
goto cleanup;
if (qemuAssignDevicePCISlots(def, addrs) < 0)
if (qemuAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
goto cleanup;
for (i = 0; i < def->ncontrollers; i++) {
@ -2426,6 +2426,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
*/
int
qemuAssignDevicePCISlots(virDomainDefPtr def,
virQEMUCapsPtr qemuCaps,
virDomainPCIAddressSetPtr addrs)
{
size_t i, j;
@ -2618,6 +2619,12 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)
continue;
/* Also ignore virtio-mmio disks if our machine allows them */
if (def->disks[i]->info.type ==
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MMIO))
continue;
if (def->disks[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("virtio disk cannot have an address of type '%s'"),

View File

@ -284,6 +284,7 @@ virDomainPCIAddressSetPtr qemuDomainPCIAddressSetCreate(virDomainDefPtr def,
bool dryRun);
int qemuAssignDevicePCISlots(virDomainDefPtr def,
virQEMUCapsPtr qemuCaps,
virDomainPCIAddressSetPtr addrs);
int qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr qemuCaps);