Bug 1585108 - Update virtual interface with alias return success but no change
Summary: Update virtual interface with alias return success but no change
Keywords:
Status: CLOSED DUPLICATE of bug 1621910
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: yalzhang@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-06-01 10:04 UTC by yafu
Modified: 2019-01-10 16:14 UTC (History)
6 users (show)

Fixed In Version: libvirt-4.5.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-01-10 16:14:36 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Bugzilla 1621910 None CLOSED virDomainUpdateDeviceFlags fails when alias is not specified 2019-06-18 03:00:17 UTC

Internal Links: 1621910

Description yafu 2018-06-01 10:04:16 UTC
Description of problem:
Update virtual interface with alias return success but no change.

Version-Release number of selected component (if applicable):
libvirt-4.3.0-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Prepare default network interface xml with alias name:
#cat interface.xml
<interface type='network'>
      <mac address='54:52:00:54:9e:f4'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='ua-88c2decd-4883-4023-84de-a2205c777af7'/>
</interface>

2.Attach it to a running guest:
#virsh attach-device ovmf interface.xml
Device attached successfully

3.Check the live xml:
#virsh dumpxml ovmf
<interface type='network'>
      <mac address='54:52:00:54:96:f4'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet12'/>
      <model type='virtio'/>
      <alias name='ua-88c2decd-4883-4023-84de-a2205c777af7'/>
      <address type='pci' domain='0x0000' bus='0x0a' slot='0x00' function='0x0'/>
</interface>


4.Modify the alias name in interface.xml:
#cat interface.xml
<interface type='network'>
      <mac address='54:52:00:54:9e:f4'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      ***<alias name='ua-88c2decd'/>***
</interface>


5.Live update the virtual interface with alias name:
#virsh update-device ovmf interface.xml
Device updated successfully

6.Check the live xml and the alias name did not change after step 5:
#virsh dumpxml ovmf
<interface type='network'>
      <mac address='54:52:00:54:96:f4'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet12'/>
      <model type='virtio'/>
      <alias name='ua-88c2decd-4883-4023-84de-a2205c777af7'/>
      <address type='pci' domain='0x0000' bus='0x0a' slot='0x00' function='0x0'/>
</interface>

Actual results:
Update virtual interface with alias return success but no change.

Expected results:
It should report error if not support live update of alias name.

Additional info:
It can report error if the virtual interface xml contains address tag, such as:
#cat interface.xml
<interface type='network'>
      <mac address='54:52:00:54:96:f4'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='ua-88c2decd-4883-4023-84de-a2205c777af7'/>
     ****<address type='pci' domain='0x0000' bus='0x0a' slot='0x00' function='0x0'/>****
</interface>

Comment 2 Michal Privoznik 2018-06-12 15:05:50 UTC
Patches proposed upstream:

https://www.redhat.com/archives/libvir-list/2018-June/msg00971.html

Comment 4 Michal Privoznik 2018-06-27 14:50:16 UTC
Patches pushed upstream:

commit 4ad54a417a1bbe10aeffcce783f4381d8d43f799
Author:     Michal Privoznik <mprivozn@redhat.com>
AuthorDate: Tue Jun 12 16:05:10 2018 +0200
Commit:     Michal Privoznik <mprivozn@redhat.com>
CommitDate: Wed Jun 27 16:43:09 2018 +0200

    conf: Forbid device alias change on device-update
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1585108
    
    When updating a live device users might pass different alias than
    the one the device has. Currently, this is silently ignored which
    goes against our behaviour for other parts of the device where we
    explicitly allow only certain changes and error out loudly on
    anything else.
    
    Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
    Reviewed-by: John Ferlan <jferlan@redhat.com>

commit 5e9b150fe0491f394c3235f0fdb476262b66e310
Author:     Michal Privoznik <mprivozn@redhat.com>
AuthorDate: Tue Jun 26 10:37:27 2018 +0200
Commit:     Michal Privoznik <mprivozn@redhat.com>
CommitDate: Wed Jun 27 16:42:27 2018 +0200

    conf: Reintroduce action to virDomainDefCompatibleDevice
    
    This was lost in c57f3fd2f8999d17e01. But now we are going to
    need it again (except the DETACH action where checking for device
    compatibility does not make much sense anyway).
    
    Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
    Reviewed-by: John Ferlan <jferlan@redhat.com>

commit 84de7fbfdb2f528e05d98c09e3260fe0fc0739f9
Author:     Michal Privoznik <mprivozn@redhat.com>
AuthorDate: Tue Jun 12 16:04:30 2018 +0200
Commit:     Michal Privoznik <mprivozn@redhat.com>
CommitDate: Wed Jun 27 15:57:49 2018 +0200

    qemuDomainUpdateDeviceFlags: Parse device as live if needed
    
    When updating device it's worth parsing live info too as users
    might want to update it as well.
    
    Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
    Reviewed-by: John Ferlan <jferlan@redhat.com>

v4.5.0-rc1-3-g4ad54a417a

Comment 6 yalzhang@redhat.com 2018-07-05 03:40:09 UTC
test on libvirt-4.5.0-1.el7.x86_64, the result is as expected, set this bug to be verified.

no matter match by mac, or pci address, or both, it always report error when update-device to live update alias name for interface.

1. prepare a guest with interfaces as below
# virsh dumpxml rhelq | grep /interface -B8
    <interface type='network'>
      <mac address='52:54:00:4d:f0:70'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <filterref filter='clean-traffic'/>
      <alias name='ua-88c2decd-4883-4023-84de-a2205c777af7'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </interface>
    <interface type='network'>
      <mac address='52:54:00:f2:c4:0b'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet1'/>
      <model type='rtl8139'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x02' function='0x0'/>
    </interface>

# cat net.xml
    <interface type='network'>
      <mac address='52:54:00:4d:f0:70'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <filterref filter='clean-traffic'/>
      <alias name='ua-88c2decd-4883-4023-84de-a2205c777af7'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </interface>

2. edit the alias name, and delete the pci address in net.xml, then do update-device. It will match by mac address.
# cat net.xml
    <interface type='network'>
      <mac address='52:54:00:4d:f0:70'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <filterref filter='clean-traffic'/>
      <alias name='ua-88c2decd-4883-4023-84de-a2205c777af8'/>
    </interface>

# virsh update-device rhelq net.xml
error: Failed to update device from net.xml
error: operation forbidden: changing device alias is not allowed

3. delete the alias name from step 2
# virsh update-device rhelq net.xml
error: Failed to update device from net.xml
error: operation forbidden: changing device alias is not allowed
===> This is expected, when there is no alias specified in xml, libvirt may generate a new one

4. add pci address, and delete mac address in step2 xml, it will match by pci address
# cat net.xml
<interface type='network'>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <filterref filter='clean-traffic'/>
      <alias name='ua-88c2decd-4883-4023-84de-a2205c777af8'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </interface>
# virsh update-device rhelq net.xml
error: Failed to update device from net.xml
error: operation forbidden: changing device alias is not allowed

Comment 7 jiyan 2018-07-11 06:55:44 UTC
Hi, Michal.
It seems that the patches fixing this bug have some unexpected effect on the following issue, the error is abnormal, could you please help to check it.
Thank you, :)

Version:
kernel-3.10.0-919.el7.x86_64
libvirt-4.5.0-2.el7.x86_64
qemu-kvm-rhev-2.12.0-7.el7.x86_64

Steps:
1. Prepare a VM with the following configuration and then start VM
# virsh dumpxml bug1 --inactive |grep "<disk" -A10
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/new.iso'/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

# virsh start bug1
Domain bug1 started

2. Update media of active dumpxml by running the following cmd
# virsh change-media bug1 hdb --update /var/lib/libvirt/images/old.iso --live
Successfully updated media.

# virsh dumpxml bug1 |grep "<disk" -A10
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/old.iso'/>
      <backingStore/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <alias name='ide0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

3. Update media of inactive dumpxml by running the following cmd
# virsh change-media bug1 hdb --update /var/lib/libvirt/images/old.iso --config
Successfully updated media.

# virsh dumpxml bug1 --inactive |grep "<disk" -A10
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/old.iso'/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

4. Use '--live' and '--config' at the same time, the following error raised
# virsh change-media bug1 hdb --update /var/lib/libvirt/images/old.iso --config --live
error: Failed to complete action update on media
error: operation forbidden: changing device alias is not allowed

Comment 8 yalzhang@redhat.com 2018-07-15 10:28:49 UTC
Same for update-device:

# virsh start rhelq
Domain rhelq started

# virsh dumpxml rhelq | grep /interface -B9
<interface type='network'>
      <mac address='52:54:00:ad:ad:da'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='rtl8139'/>
      <link state='down'/>
      <alias name='net1'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x02' function='0x0'/>
    </interface>

# cat net.xml
<interface type='network'>
      <mac address='52:54:00:ad:ad:da'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='rtl8139'/>
      <alias name='net1'/>
<link state='up'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x02' function='0x0'/>
    </interface>

# virsh update-device rhelq net.xml --config --live 
error: Failed to update device from net.xml
error: operation forbidden: changing device alias is not allowed

# virsh update-device rhelq net.xml --persistent
error: Failed to update device from net.xml
error: operation forbidden: changing device alias is not allowed

Set back to ON_QA status

Comment 9 jiyan 2018-07-23 06:29:49 UTC
Filed another bug in RHEL 8 
Bug 1603133 - "changing device alias is not allowed" info raised when 'change-media --config --live' for disk without changing alias

Comment 13 Michal Privoznik 2019-01-10 16:14:36 UTC
I think this turned out to be duplicate of bug 1621910 and/or this bug was fixed by patches posted for that bug. Therefore I'm closing this one as a duplicate of the other.

*** This bug has been marked as a duplicate of bug 1621910 ***


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