Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1554928

Summary: 'update-device' with alias in disk did not work actually and 'cold-plug' device with alias to running VM will fail in dumpxml file [rhel-7.5.z]
Product: Red Hat Enterprise Linux 7 Reporter: Oneata Mircea Teodor <toneata>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: jiyan <jiyan>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 7.5CC: dyuan, hhan, jdenemar, jherrman, jiyan, jsuchane, lmen, meili, mprivozn, mtessun, rbalakri, salmy, xuzhang, yalzhang, yisun
Target Milestone: rcKeywords: Upstream, ZStream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-3.9.0-14.el7_5.1 Doc Type: Bug Fix
Doc Text:
Previously, the libvirt service used the incorrect XML configuration when checking for a duplicate user alias. As a consequence, hot-plugging a device with a unique alias to a guest virtual machine in some cases failed with a "non unique alias" error message. With this update, libvirt uses the correct XML files for verifying the device alias, which prevents the problem from occurring.
Story Points: ---
Clone Of: 1543775 Environment:
Last Closed: 2018-04-10 19:13:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1543775    
Bug Blocks:    

Description Oneata Mircea Teodor 2018-03-13 15:15:47 UTC
This bug has been copied from bug #1543775 and has been proposed to be backported to 7.5 z-stream (EUS).

Comment 5 jiyan 2018-03-16 03:43:14 UTC
Hi, Michal, I still can reproduce this issue: 'update-device' with alias in disk did not work actually. Could you please help to check it?

Version:
kernel-3.10.0-860.el7.x86_64
qemu-kvm-rhev-2.10.0-21.el7_5.1.x86_64
libvirt-3.9.0-14.virtcov.el7_5.1.x86_64

Step:
# virsh domstate test1
shut off

# virsh start test1
Domain test1 started

# virsh dumpxml test1 |grep "<disk" -A7
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/RHEL-7.5-x86_64-latest.qcow2'/>
      <backingStore/>
      <target dev='hda' bus='usb'/>
      <alias name='usb-disk0'/>
      <address type='usb' bus='0' port='1.3'/>
    </disk>

# cat diskchangealias.xml 
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/RHEL-7.5-x86_64-latest.qcow2'/>
      <backingStore/>
      <target dev='hda' bus='usb'/>
      <alias name='ua-disk2'/>
    </disk>

# virsh update-device test1 diskchangealias.xml 
Device updated successfully

# virsh dumpxml test1 |grep "<disk" -A7
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/RHEL-7.5-x86_64-latest.qcow2'/>
      <backingStore/>
      <target dev='hda' bus='usb'/>
      <alias name='usb-disk0'/>   ***Not changed here***
      <address type='usb' bus='0' port='1.3'/>
    </disk>

Comment 6 Michal Privoznik 2018-03-16 11:52:13 UTC
(In reply to jiyan from comment #5)
> Hi, Michal, I still can reproduce this issue: 'update-device' with alias in
> disk did not work actually. Could you please help to check it?
> 
> Version:
> kernel-3.10.0-860.el7.x86_64
> qemu-kvm-rhev-2.10.0-21.el7_5.1.x86_64
> libvirt-3.9.0-14.virtcov.el7_5.1.x86_64
> 
> Step:
> # virsh domstate test1
> shut off
> 
> # virsh start test1
> Domain test1 started
> 
> # virsh dumpxml test1 |grep "<disk" -A7
>     <disk type='file' device='disk'>
>       <driver name='qemu' type='qcow2'/>
>       <source file='/var/lib/libvirt/images/RHEL-7.5-x86_64-latest.qcow2'/>
>       <backingStore/>
>       <target dev='hda' bus='usb'/>
>       <alias name='usb-disk0'/>
>       <address type='usb' bus='0' port='1.3'/>
>     </disk>
> 
> # cat diskchangealias.xml 
>     <disk type='file' device='disk'>
>       <driver name='qemu' type='qcow2'/>
>       <source file='/var/lib/libvirt/images/RHEL-7.5-x86_64-latest.qcow2'/>
>       <backingStore/>
>       <target dev='hda' bus='usb'/>
>       <alias name='ua-disk2'/>
>     </disk>
> 
> # virsh update-device test1 diskchangealias.xml 
> Device updated successfully
> 
> # virsh dumpxml test1 |grep "<disk" -A7
>     <disk type='file' device='disk'>
>       <driver name='qemu' type='qcow2'/>
>       <source file='/var/lib/libvirt/images/RHEL-7.5-x86_64-latest.qcow2'/>
>       <backingStore/>
>       <target dev='hda' bus='usb'/>
>       <alias name='usb-disk0'/>   ***Not changed here***
>       <address type='usb' bus='0' port='1.3'/>
>     </disk>

This is harmless. I'm gonna post a patch that forbids changing alias for live domains. However, this shouldn't matter for RHEL-7.5.z.

Comment 7 jiyan 2018-03-19 01:13:44 UTC
Version:
qemu-kvm-rhev-2.10.0-21.el7_5.1.x86_64
kernel-3.10.0-861.el7.x86_64
libvirt-3.9.0-14.el7_5.1.x86_64

The following steps are trying to verify the Issue-2 in the bug description.

Scenario: Cold-plug interface to running VM twice, then hot-plug the interface twice, at last, hot-unplug and cold-unplug the interface.

Step1. Prepare a shutdown VM and a xml file as following
# virsh domstate test1
shut off

# virsh dumpxml test1 |grep "<interface" -A5
    <interface type='network'>
      <mac address='52:54:00:32:e6:35'/>
      <source network='default'/>
      <model type='rtl8139'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

# cat interface.xml 
    <interface type='network'>
      <mac address='22:54:00:32:e6:35'/>
      <source network='default'/>
      <model type='rtl8139'/>
      <alias name='ua-interface'/>
    </interface>

Step2. Start VM and cold-plug the interface, check dumpxml file info
# virsh start test1
Domain test1 started

# virsh attach-device test1 interface.xml --config
Device attached successfully

# virsh dumpxml test1 |grep "<interface" -A7
    <interface type='network'>
      <mac address='52:54:00:32:e6:35'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='rtl8139'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

# virsh dumpxml test1 --inactive|grep "<interface" -A6
    <interface type='network'>
      <mac address='52:54:00:32:e6:35'/>
      <source network='default'/>
      <model type='rtl8139'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <interface type='network'>
      <mac address='22:54:00:32:e6:35'/>
      <source network='default'/>
      <model type='rtl8139'/>
      <alias name='ua-interface'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </interface>

Step3: Clod-plug the interface again, there should be some error info, the dumpxml file info shoule be same with Step-2
# virsh attach-device test1 interface.xml --config
error: Failed to attach device from interface.xml
error: XML error: non unique alias detected: ua-interface

# virsh dumpxml test1 |grep "<interface" -A7
Same with Step-2

# virsh dumpxml test1 --inactive|grep "<interface" -A6
Same with Step-2

Step4: Hot-plug the interface again and check the dumpxml file info
# virsh attach-device test1 interface.xml 
Device attached successfully

# virsh dumpxml test1 |grep "<interface" -A7
    <interface type='network'>
      <mac address='52:54:00:32:e6:35'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='rtl8139'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <interface type='network'>
      <mac address='22:54:00:32:e6:35'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet1'/>
      <model type='rtl8139'/>
      <alias name='ua-interface'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </interface>

# virsh dumpxml test1 --inactive|grep "<interface" -A6
    <interface type='network'>
      <mac address='52:54:00:32:e6:35'/>
      <source network='default'/>
      <model type='rtl8139'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <interface type='network'>
      <mac address='22:54:00:32:e6:35'/>
      <source network='default'/>
      <model type='rtl8139'/>
      <alias name='ua-interface'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </interface>

Step5: Hot-plug the interface again, there should be some error info, the dumpxml file info shoule be same with Step-4
# virsh attach-device test1 interface.xml
error: Failed to attach device from interface.xml
error: XML error: non unique alias detected: ua-interface

# virsh dumpxml test1 |grep "<interface" -A7
Same with Step-4

# virsh dumpxml test1 --inactive|grep "<interface" -A6
Same with Step-4

Step6: Hot-unplug the interface and check the dumpxml file info
# virsh detach-device test1 interface.xml 
Device detached successfully

# virsh dumpxml test1 --inactive|grep "<interface" -A6
    <interface type='network'>
      <mac address='52:54:00:32:e6:35'/>
      <source network='default'/>
      <model type='rtl8139'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <interface type='network'>
      <mac address='22:54:00:32:e6:35'/>
      <source network='default'/>
      <model type='rtl8139'/>
      <alias name='ua-interface'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </interface>

# virsh dumpxml test1|grep "<interface" -A7
    <interface type='network'>
      <mac address='52:54:00:32:e6:35'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='rtl8139'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

Step7: Hot-unplug the interface again, there should be some error info, the dumpxml file info shoule be same with Step-6
# virsh detach-device test1 interface.xml 
error: Failed to detach device from interface.xml
error: operation failed: no device matching MAC address 22:54:00:32:e6:35 found

# virsh dumpxml test1 |grep "<interface" -A7
Same with Step-6

# virsh dumpxml test1 --inactive|grep "<interface" -A6
Same with Step-6

Step8: Cold-unplug the interface and check the dumpxml file info
# virsh detach-device test1 interface.xml --config
Device detached successfully

# virsh dumpxml test1|grep "<interface" -A7
    <interface type='network'>
      <mac address='52:54:00:32:e6:35'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='rtl8139'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

# virsh dumpxml test1 --inactive|grep "<interface" -A5
    <interface type='network'>
      <mac address='52:54:00:32:e6:35'/>
      <source network='default'/>
      <model type='rtl8139'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

Step9: Cold-unplug the interface again, there should be some error info, the dumpxml file info shoule be same with Step-8
# virsh detach-device test1 interface.xml --config
error: Failed to detach device from interface.xml
error: operation failed: no device matching MAC address 22:54:00:32:e6:35 found

# virsh dumpxml test1 |grep "<interface" -A7
Same with Step-8

# virsh dumpxml test1 --inactive|grep "<interface" -A5
Same with Step-8

All the results are as expected, move this bug to 'verified'.

Comment 10 errata-xmlrpc 2018-04-10 19:13:42 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-2018:1056