Bug 1599513 - unsupported live update of interface's rom 'enabled' attribute reports success
Summary: unsupported live update of interface's rom 'enabled' attribute reports success
Keywords:
Status: VERIFIED
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
: 8.0
Assignee: Ján Tomko
QA Contact: yalzhang@redhat.com
URL:
Whiteboard:
Depends On:
Blocks: 1661367
TreeView+ depends on / blocked
 
Reported: 2018-07-10 01:33 UTC by yalzhang@redhat.com
Modified: 2019-08-26 20:25 UTC (History)
7 users (show)

Fixed In Version: libvirt-5.0.0-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1661367 (view as bug list)
Environment:
Last Closed:
Type: Bug
Target Upstream Version:


Attachments (Terms of Use)

Description yalzhang@redhat.com 2018-07-10 01:33:24 UTC
Description of problem:
live update rom 'enabled' attribute of interface report succeed but no changes

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

How reproducible:
100%

Steps to Reproduce:
1. Start a guest with interface as below with rom enabled='no':
# virsh dumpxml rhel | grep /interface -B9
    <interface type='direct'>
      <mac address='52:54:00:78:36:26'/>
      <source dev='eno1' mode='bridge'/>
      <target dev='macvtap0'/>
      <model type='rtl8139'/>
      <boot order='1'/>
      <alias name='net0'/>
      <rom enabled='no'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </interface>

2. Dump the interface xml and modify the rom enabled to 'no', then do live update:
# cat direct.xml
<interface type='direct'>
      <mac address='52:54:00:78:36:26'/>
      <source dev='eno1' mode='bridge'/>
      <target dev='macvtap0'/>
      <model type='rtl8139'/>
      <boot order='1'/>
      <alias name='net0'/>
  *** <rom enabled='yes'/> ***
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </interface>

3. Live update succeed but no changes in xml.
# virsh update-device rhel direct.xml
Device updated successfully

# virsh dumpxml rhel | grep /interface -B9
    <interface type='direct'>
      <mac address='52:54:00:78:36:26'/>
      <source dev='eno1' mode='bridge'/>
      <target dev='macvtap0'/>
      <model type='rtl8139'/>
      <boot order='1'/>
      <alias name='net0'/>
      <rom enabled='no'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </interface>

Actual results:
live update rom 'enabled' attribute of interface report succeed but no changes in xml

Expected results:
Report error when live update rom 'enabled' attribute like:
"error: Operation not supported: cannot modify network rom xxx"

Additional info:
When live update rom 'file' path attribute:
# virsh update-device rhel direct_file.xml
error: Failed to update device from direct.xml
error: Operation not supported: cannot modify network rom file

When live update rom 'bar' attribute:
# virsh update-device rhel direct_bar.xml
error: Failed to update device from direct.xml
error: Operation not supported: cannot modify network device rom bar setting

Comment 2 Katerina Koukiou 2018-07-13 15:39:01 UTC
fixed by: https://www.redhat.com/archives/libvir-list/2018-July/msg00874.html

Comment 3 Katerina Koukiou 2018-07-16 09:36:18 UTC
v4.5.0-148-g611b038fb6

commit 611b038fb60e23eb574148192090f33bc7264be2
Author: Katerina Koukiou <kkoukiou@redhat.com>
Date:   Fri Jul 13 15:07:58 2018 +0200

    qemu: hotplug: report error when changing rom enabled attr for net iface

Comment 6 yalzhang@redhat.com 2018-07-26 02:11:28 UTC
Test on libvirt-4.5.0-4.el7.x86_64, when update device with new xml without pci address, the issue still exists, check scenario 2, it is just like Bug 1585108.

I have tried several scenarios and found when update-device for interface, the new xml must include the correct mac address for the interface, and the pci address is not a must. If do not specify the pci address, the behavior is different, like Bug 1585108 and scenario 2 here.

Scenario 1:
1) Prepare vm running with below interface:
# virsh dumpxml rhel | grep /interface -B7
    <interface type='network'>
      <mac address='52:54:00:fa:81:87'/>
      <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>

2) Add "<rom enabled='yes'/>" and update the device:
# virsh dumpxml rhel | grep /interface -B7 > net.xml
# cat net.xml
    <interface type='network'>
      <mac address='52:54:00:fa:81:87'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='rtl8139'/>
    ** <rom enabled='yes'/> **
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> 
    </interface>
# virsh update-device rhel net.xml
error: Failed to update device from net.xml
error: Operation not supported: cannot modify network device rom enabled setting

This is expected, but when delete the pci address in the xml, it still report succeed but no changes:

Scenario 2: 
# cat net.xml
    <interface type='network'>
      <mac address='52:54:00:fa:81:87'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='rtl8139'/>
      <alias name='net0'/>
    ** <rom enabled='yes'/> **
    </interface>

# virsh update-device rhel net.xml
Device updated successfully

# virsh dumpxml rhel | grep /interface -B7
    <interface type='network'>
      <mac address='52:54:00:fa:81:87'/>
      <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>

Comment 7 yalzhang@redhat.com 2018-07-26 03:32:53 UTC
Except the 'enabled' attribute, there is same issue with other attributes of rom element: bar, file. when update with new xml without pci address, the behavior is unexpected.

1. The vm is running with interface as below, no rom setting:
# virsh dumpxml rhel |grep /interface -B8
    <interface type='network'>
      <mac address='52:54:00:db:0c:00'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <boot order='1'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

# virsh dumpxml rhel |grep /interface -B8 > net.xml

2. Edit the xml to add "<rom bar='off'/>", keep the pci address in the new xml
# cat net.xml
    <interface type='network'>
      <mac address='52:54:00:db:0c:00'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <boot order='1'/>
** <rom bar='off'/> **
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

# virsh update-device rhel net.xml
error: Failed to update device from net.xml
error: Operation not supported: cannot modify network device rom bar setting

This is expected, but when delete the pci address in the new xml:

3. Delete the pci address in the new xml, the update will report success, but no changes in xml:
# cat net.xml
    <interface type='network'>
      <mac address='52:54:00:db:0c:00'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <boot order='1'/>
**<rom bar='off'/> **
      <alias name='net0'/>
    </interface>

# virsh update-device rhel net.xml
Device updated successfully

# virsh dumpxml rhel | grep /interface -B8
    <interface type='network'>
      <mac address='52:54:00:db:0c:00'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <boot order='1'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

same with file attribute
# cat net.xml
    <interface type='network'>
      <mac address='52:54:00:db:0c:00'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <boot order='1'/>
** <rom file='/usr/share/qemu-kvm/pxe-virtio.rom'/> **
      <alias name='net0'/>
    </interface>

# virsh update-device rhel net.xml
Device updated successfully

# virsh dumpxml rhel | grep  /interface -B9 | grep rom
===> no outputs

Comment 8 yalzhang@redhat.com 2018-07-26 03:39:50 UTC
Same with boot order, which do not support live update either:

1. prepare running vm with "<boot order='1'/>" in interface
# virsh dumpxml rhel | grep /interface -B8
    <interface type='network'>
      <mac address='52:54:00:db:0c:00'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      ** <boot order='1'/> **
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

2. change the boot order into 2 in new xml, and delete the pci address
# cat net.xml
    <interface type='network'>
      <mac address='52:54:00:db:0c:00'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
     ** <boot order='2'/> **
      <alias name='net0'/>
    </interface>

3. live update report success, but no change in xml
# virsh update-device rhel net.xml
Device updated successfully

# virsh dumpxml rhel | grep /interface -B8
    <interface type='network'>
      <mac address='52:54:00:db:0c:00'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
    **  <boot order='1'/> **
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

4. if add the pci address, it will report error, this is expected
# cat net.xml
    <interface type='network'>
      <mac address='52:54:00:db:0c:00'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
     ** <boot order='2'/> **
      <alias name='net0'/>
*<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>*
    </interface>

# virsh update-device rhel net.xml
error: Failed to update device from net.xml
error: Operation not supported: cannot modify network device boot index setting

Comment 9 Katerina Koukiou 2018-08-01 12:33:01 UTC
fixed by: https://www.redhat.com/archives/libvir-list/2018-August/msg00018.html

Comment 10 Katerina Koukiou 2018-08-27 15:17:36 UTC
v4.6.0-319-gaa3e07caec

commit aa3e07caec6179dfa6479deab14a21a493637d53
Author: Katerina Koukiou <kkoukiou@redhat.com>
Date:   Fri Aug 24 12:28:41 2018 +0200

    qemu: qemuDomainChangeNet: validity checks should be done before XML autocompletion

Comment 12 yalzhang@redhat.com 2018-12-21 09:57:42 UTC
I have tested on the version which the patch in comment 10 should be included. 
And for scenarios as below, when update something to null, the same issue occurs.
It is tracked in bug 1661367
1. <rom enabled='yes'/> to <rom enabled='no'/> with/without pci ------> PASS(not support)
2. <rom enabled='yes'/> to NULL with/without pci ---------> FAIL(report succeed but no changes)
3. NULL to <rom enabled='no'> with/without pci --------> PASS(not support)

4. <boot order='1'/> to <boot order='2'/> with/without pci -----> PASS
5. <boot order='1'/> to NULL without/with pci ------> FAIL
6. NULL to <boot order='1'/> with/without pci --------> PASS

Comment 13 Ján Tomko 2019-03-28 12:38:45 UTC
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainUpdateDeviceFlags
Per our documentation for virDomainUpdateDeviceFlags:
    This method is used for actions such changing CDROM/Floppy device media,
    altering the graphics configuration such as password,
    reconfiguring the NIC device backend connectivity, etc.

This API is not intended to allow changing the frontend on the interface. In that spirit,
we have allowed changing the interface based on incomplete XML - in practice, one of (MAC address,
PCI address) is enough to match the network. This is ambiguous and can lead to people specifying incomplete
XML, so Michal added more documentation for bug 1621910:

    The supplied XML description of the device should contain all the information
    that is found in the corresponding domain XML. Leaving out any piece of information
    may be treated as a request for its removal, which may be denied.


Per comment 12, we already correctly report an error when the <rom> or <boot order> attributes are present
and different, which is not a supported change.
For omitted attributes, let's deal with that in bug 1661367

Comment 15 yalzhang@redhat.com 2019-07-08 09:54:32 UTC
Test on libvirt-5.0.0-11.module+el8.0.1+3459+e357ef2f.x86_64 with scenarios in comment 12, the result is the same as in comment 12.
Per comment 13, move this bug to be verified.


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