[PATCH] pci address conflict when virtio disk with drive type address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When using the xml as below:
-------------------------------
<devices>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/home/soulxu/VM/images/linux.img'/>
      <target dev='hda' 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='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

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@xxxxxxxxxxxxxxxxxx>
---
 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;
+        }
     }
 
     def->src = source;
-- 
1.7.5.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]