mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
pci address conflict when virtio disk with drive type
When using the xml as below: ------------------------------------------------------ <devices> <emulator>/home/soulxu/data/work-code/qemu-kvm/x86_64-softmmu/qemu-system-x86_64</emulator> <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/home/soulxu/data/VM/images/linux.img'/> <target dev='vda' bus='virtio'/> <address type='drive' controller='0' bus='0' unit='0'/> </disk> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'/> <video> <model type='cirrus' vram='9216' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </memballoon> </devices> ------------------------------------------------------ Then can't startup qemu, the error message as below: virsh # start test-vm error: Failed to start domain test-vm error: internal error process exited while connecting to monitor: qemu-system-x86_64: -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3: PCI: slot 3 function 0 not available for virtio-balloon-pci, in use by virtio-blk-pci qemu-system-x86_64: -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3: Device 'virtio-balloon-pci' could not be initialized So adding check for bus type and address type. Only the address of pci type support by virtio bus. Signed-off-by: Xu He Jie <xuhj@linux.vnet.ibm.com>
This commit is contained in:
parent
44477c57be
commit
5fb0de2e4d
@ -1319,15 +1319,21 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Disks (VirtIO only for now */
|
||||
/* Disks (VirtIO only for now) */
|
||||
for (i = 0; i < def->ndisks ; i++) {
|
||||
if (def->disks[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
|
||||
continue;
|
||||
|
||||
/* Only VirtIO disks use PCI addrs */
|
||||
if (def->disks[i]->bus != VIR_DOMAIN_DISK_BUS_VIRTIO)
|
||||
continue;
|
||||
|
||||
if (def->disks[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
|
||||
continue;
|
||||
|
||||
if (def->disks[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
|
||||
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("virtio only support device address type 'PCI'"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (qemuDomainPCIAddressSetNextAddr(addrs, &def->disks[i]->info) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user