mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-09 09:14:57 +00:00
https://bugzilla.redhat.com/show_bug.cgi?id=1142631 This patch resolves a situation where the same "<target dev='$name'...>" can be used for multiple disks in the domain. While the $name is "mostly" advisory regarding the expected order that the disk is added to the domain and not guaranteed to map to the device name in the guest OS, it still should be unique enough such that other domblk* type operations can be performed. Without the patch, the domblklist will list the same Target twice: $ virsh domblklist $dom Target Source ------------------------------------------------ sda /var/lib/libvirt/images/file.qcow2 sda /var/lib/libvirt/images/file.img Additionally, getting domblkstat, domblkerror, domblkinfo, and other block* type calls will not be able to reference the second target. Fortunately, hotplug disallows adding a "third" sda value: $ qemu-img create -f raw /var/lib/libvirt/images/file2.img 10M $ virsh attach-disk $dom /var/lib/libvirt/images/file2.img sda error: Failed to attach disk error: operation failed: target sda already exists $ BUT, it since 'sdb' doesn't exist one would get the following on the same hotplug attempt, but changing to use 'sdb' instead of 'sda' $ virsh attach-disk $dom /var/lib/libvirt/images/file2.img sdb error: Failed to attach disk error: internal error: unable to execute QEMU command 'device_add': Duplicate ID 'scsi0-0-1' for device $ Since we cannot fix this issue at parsing time, the best that can be done so as to not "lose" a domain is to make the check prior to starting the guest with the results as follows: $ virsh start $dom error: Failed to start domain $dom error: XML error: target 'sda' duplicated for disk sources '/var/lib/libvirt/images/file.qcow2' and '/var/lib/libvirt/images/file.img' $ Running 'make check' found a few more instances in the tests where this duplicated target dev value was being used. These also exhibited some duplicated 'id=' values (negating the uniqueness argument of aliases) in the corresponding .args file and of course the *xmlout version of a few input XML files.
215 lines
8.9 KiB
XML
215 lines
8.9 KiB
XML
<domain type='qemu'>
|
|
<name>fdr-br</name>
|
|
<uuid>3ec6cbe1-b5a2-4515-b800-31a61855df41</uuid>
|
|
<memory unit='KiB'>2097152</memory>
|
|
<currentMemory unit='KiB'>2097152</currentMemory>
|
|
<vcpu placement='static' cpuset='0-1'>2</vcpu>
|
|
<os>
|
|
<type arch='x86_64' machine='pc-1.2'>hvm</type>
|
|
<boot dev='hd'/>
|
|
</os>
|
|
<features>
|
|
<acpi/>
|
|
<apic/>
|
|
<pae/>
|
|
</features>
|
|
<clock offset='utc'/>
|
|
<on_poweroff>destroy</on_poweroff>
|
|
<on_reboot>restart</on_reboot>
|
|
<on_crash>restart</on_crash>
|
|
<devices>
|
|
<emulator>/usr/libexec/qemu-kvm</emulator>
|
|
<disk type='file' device='cdrom'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/iso/f18kde.iso'/>
|
|
<target dev='hdc' bus='ide'/>
|
|
<readonly/>
|
|
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
|
|
</disk>
|
|
<controller type='usb' index='0'>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
|
</controller>
|
|
<controller type='ide' index='0'>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
|
</controller>
|
|
<controller type='pci' index='0' model='pci-root'/>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/test.img'/>
|
|
<target dev='vda' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/test1.img'/>
|
|
<target dev='vdb' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-a-a.img'/>
|
|
<target dev='vdaa' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-a-b.img'/>
|
|
<target dev='vdab' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-a-c.img'/>
|
|
<target dev='vdac' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-a-d.img'/>
|
|
<target dev='vdad' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-b-a.img'/>
|
|
<target dev='vdba' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-b-b.img'/>
|
|
<target dev='vdbb' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-b-c.img'/>
|
|
<target dev='vdbc' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-b-d.img'/>
|
|
<target dev='vdbd' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-c-a.img'/>
|
|
<target dev='vdca' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-c-b.img'/>
|
|
<target dev='vdcb' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x0f' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-c-c.img'/>
|
|
<target dev='vdcc' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-c-d.img'/>
|
|
<target dev='vdcd' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x11' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-d-a.img'/>
|
|
<target dev='vdda' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x12' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-d-b.img'/>
|
|
<target dev='vddb' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x13' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-d-c.img'/>
|
|
<target dev='vddc' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x14' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-d-d.img'/>
|
|
<target dev='vddd' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x15' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-e-a.img'/>
|
|
<target dev='vdea' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x16' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-e-b.img'/>
|
|
<target dev='vdeb' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x17' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-e-c.img'/>
|
|
<target dev='vdec' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x18' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-e-d.img'/>
|
|
<target dev='vded' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x19' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-f-a.img'/>
|
|
<target dev='vdfa' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x1a' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-f-b.img'/>
|
|
<target dev='vdfb' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x1b' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-f-c.img'/>
|
|
<target dev='vdfc' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x1c' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-f-d.img'/>
|
|
<target dev='vdfd' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-g-a.img'/>
|
|
<target dev='vdga' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
|
|
</disk>
|
|
<disk type='file' device='disk'>
|
|
<driver name='qemu' type='raw'/>
|
|
<source file='/var/lib/libvirt/images/disk-g-b.img'/>
|
|
<target dev='vdgb' bus='virtio'/>
|
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x0'/>
|
|
</disk>
|
|
<input type='mouse' bus='ps2'/>
|
|
<input type='keyboard' bus='ps2'/>
|
|
<video>
|
|
<model type='cirrus' vram='16384' 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='0x06' function='0x0'/>
|
|
</memballoon>
|
|
</devices>
|
|
</domain>
|