Bug 1697676 - attach disk with non unique alias name using --persistent option should report error msg
Summary: attach disk with non unique alias name using --persistent option should repor...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: Han Han
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-04-09 02:08 UTC by Lili Zhu
Modified: 2020-11-14 06:56 UTC (History)
8 users (show)

Fixed In Version: libvirt-5.3.0-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-06 07:14:08 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:3723 0 None None None 2019-11-06 07:14:36 UTC

Description Lili Zhu 2019-04-09 02:08:20 UTC
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

Comment 1 Michal Privoznik 2019-04-26 13:52:51 UTC
Patches proposed upstream:

https://www.redhat.com/archives/libvir-list/2019-April/msg01423.html

Comment 2 Michal Privoznik 2019-04-29 07:31:38 UTC
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

Comment 4 Han Han 2019-08-07 06:18:05 UTC
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

Comment 5 Han Han 2019-09-18 07:46:15 UTC
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

Comment 7 errata-xmlrpc 2019-11-06 07:14:08 UTC
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


Note You need to log in before you can comment on or make changes to this bug.