[libvirt] [PATCH] pci address conflict when virtio disk with drive type address
Eric Blake
eblake at redhat.com
Tue Oct 18 14:52:44 UTC 2011
On 10/18/2011 03:30 AM, Xu He Jie wrote:
> When using the xml as below:
> <memballoon model='virtio'>
> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
> </memballoon>
> </devices>
> -----------------------------
>
> Then can't statup qemu, the error message as below:
> qemu-system-x86_64: -device virtio-balloon-pci,id=balloon0,bus=pci.0,multifunction=on,addr=0x3.0x0: Device 'virtio-balloon-pci' could not be initialized
The XML doesn't match the error message (slot 4 vs. slot 3); are you
sure you got this right?
>
> 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 at linux.vnet.ibm.com>
> ---
> src/conf/domain_conf.c | 8 ++++++++
> 1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 5959593..b8aa1a2 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -2644,6 +2644,14 @@ virDomainDiskDefParseXML(virCapsPtr caps,
> } else {
> if (virDomainDeviceInfoParseXML(node,&def->info, flags)< 0)
> goto error;
> +
> + if ((def->bus == VIR_DOMAIN_DISK_BUS_VIRTIO)&&
> + (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)&&
> + (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)) {
> + virDomainReportError(VIR_ERR_INTERNAL_ERROR,
> + _("virtio only support device address type 'PCI' "));
> + goto error;
> + }
This feels like the wrong place for the fix. I think the check should
be in the qemu layer, not in the generic domain_conf, as there might be
hypervisor drivers that support virtio on other buses.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
More information about the libvir-list
mailing list