Description of problem: attach disk with non unique alias name using --persistent option should report error msg Version-Release number of selected component (if applicable): libvirt-5.0.0-7.module+el8+2887+effa3c42.x86_64 qemu-kvm-3.1.0-20.module+el8+2888+cdc893a8.x86_64 How reproducible: 100% Steps to Reproduce: 1. prepare a running guest # virsh list --all Id Name State -------------------------------- 33 avocado-vt-vm1 running 2. and its disk with alias name # virsh dumpxml avocado-vt-vm1 | grep '<disk' -A7 <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/RHEL-8.0-x86_64-latest.qcow2'/> <backingStore/> <target dev='vda' bus='virtio'/> <alias name='ua-09f558d3-1223-4e82-9334-87b1eeb26925'/> <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/> </disk> 3. attach another disk with the same alias name using --persistent # virsh attach-disk avocado-vt-vm1 /var/lib/libvirt/images/vdb.qcow2 vdb --alias ua-09f558d3-1223-4e82-9334-87b1eeb26925 --persistent Disk attached successfully 4. check the guest's xml, attaching disk failed, there is no xml about the new guest # virsh dumpxml avocado-vt-vm1 | grep '<disk' -A7 <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/RHEL-8.0-x86_64-latest.qcow2'/> <backingStore/> <target dev='vda' bus='virtio'/> <alias name='ua-09f558d3-1223-4e82-9334-87b1eeb26925'/> <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/> </disk> 5. check its inactive xml, there is no xml about new disk, either # virsh dumpxml avocado-vt-vm1 --inactive | grep '<disk' -A6 <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/RHEL-8.0-x86_64-latest.qcow2'/> <target dev='vda' bus='virtio'/> <alias name='ua-09f558d3-1223-4e82-9334-87b1eeb26925'/> <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/> </disk> Expected results: Attach disk with non unique alias name using --persistent option should report error msg similar to the following: error: Failed to attach disk error: XML error: non unique alias detected: ua-09f558d3-1223-4e82-9334-87b1eeb26925 Additional info: Attaching interface with the non unique alias name using --persistent option behaves the same with the above operations
Patches proposed upstream: https://www.redhat.com/archives/libvir-list/2019-April/msg01423.html
To POST: 572c50849c qemu: Check for user alias collisions in coldplug 57eb2936f3 qemu: On attach to live XML check for user alias collision only live XML c4c44b535b qemuDomainAttachDeviceLiveAndConfig: Don't overwrite @ret 08193fdbf5 src: Check for virDomainDiskInsert() retval properly v5.3.0-rc1-4-g572c50849c
Test on libvirt-5.6.0-1.module+el8.1.0+3890+4d3d259c.x86_64 qemu-kvm-4.0.0-6.module+el8.1.0+3736+a2aefea3.x86_64: 1. Start a vm with custom device alias: # virsh dumpxml copy|xmllint --xpath '//disk' - <disk type="file" device="disk"> <driver name="qemu" type="qcow2"/> <source file="/var/lib/libvirt/images/copy.s1"/> <target dev="vda" bus="virtio"/> <alias name="ua-a"/> <address type="pci" domain="0x0000" bus="0x00" slot="0x0c" function="0x0"/> </disk> Persistantly attach a device with duplicated custom alias, then check it # virsh attach-disk copy /tmp/test.qcow2 sda --subdriver qcow2 --alias ua-a --persistent error: Failed to attach disk error: XML error: non unique alias detected: ua-a # virsh domblklist copy Target Source ------------------------------------------- vda /var/lib/libvirt/images/copy.s1 Lively attach a device with duplicated custom alias, then check it: # virsh attach-disk copy /tmp/test.qcow2 sda --subdriver qcow2 --alias ua-a --live error: Failed to attach disk error: XML error: non unique alias detected: ua-a Attach a device with duplicated custom alias by config, then check it: # virsh attach-disk copy /tmp/test.qcow2 sda --subdriver qcow2 --alias ua-a --config error: Failed to attach disk error: XML error: non unique alias detected: ua-a
Verified as comment4 on libvirt-5.6.0-5.module+el8.1.0+4229+2e4e348c.x86_64 qemu-kvm-4.1.0-10.module+el8.1.0+4234+33aa4f57.x86_64
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2019:3723