提交 d526e37b 编写于 作者: P Pavel Fedin 提交者: Martin Kletzander

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
e8d55172. Before that
qemuAssignDevicePCISlots() was never called for ARM "virt" machine.
Signed-off-by: NPavel Fedin <p.fedin@samsung.com>
上级 00e5b967
......@@ -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'"),
......
......@@ -284,6 +284,7 @@ virDomainPCIAddressSetPtr qemuDomainPCIAddressSetCreate(virDomainDefPtr def,
bool dryRun);
int qemuAssignDevicePCISlots(virDomainDefPtr def,
virQEMUCapsPtr qemuCaps,
virDomainPCIAddressSetPtr addrs);
int qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr qemuCaps);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册