Bug 2082540

Summary: Update device to update the rss setting report success but no changes in xml
Product: Red Hat Enterprise Linux 9 Reporter: yalzhang <yalzhang>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
libvirt sub component: General QA Contact: yalzhang <yalzhang>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: low CC: 1923001710, dzheng, jdenemar, lmen, mprivozn, pkrempa, virt-maint, xuzhang, yicui
Version: 9.1Keywords: Triaged, Upstream
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-8.4.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 10:04:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version: 8.4.0
Embargoed:

Description yalzhang@redhat.com 2022-05-06 11:43:05 UTC
Description of problem:
Update device to update the rss setting report success but no changes in xml

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

How reproducible:
100%

Steps to Reproduce:
1. Start vm with rss setting:
# virsh dumpxml rhel | grep /interface -B12
<interface type='network'>
      <mac address='52:54:00:1b:ba:6a'/>
      <source network='default' portid='88587315-7b1e-4364-82f9-4a6856bfae49' bridge='virbr0'/>
      <target dev='vnet14'/>
      <model type='virtio'/>
      <driver queues='4' rss='on' rss_hash_report='on'/>
      <alias name='net1'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </interface>

2. update the interface rss setting:
# cat test.xml
<interface type='network'>
      <mac address='52:54:00:1b:ba:6a'/>
      <source network='default' portid='88587315-7b1e-4364-82f9-4a6856bfae49' bridge='virbr0'/>
      <target dev='vnet14'/>
      <model type='virtio'/>
      <driver queues='4' rss='off' rss_hash_report='off'/>
      <alias name='net1'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </interface>
# virsh update-device rhel test.xml
Device updated successfully

# virsh dumpxml rhel | grep /interface -B12
<interface type='network'>
      <mac address='52:54:00:1b:ba:6a'/>
      <source network='default' portid='88587315-7b1e-4364-82f9-4a6856bfae49' bridge='virbr0'/>
      <target dev='vnet14'/>
      <model type='virtio'/>
      <driver queues='4' rss='on' rss_hash_report='on'/>
      <alias name='net1'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </interface>

Actual results:
Update device to update the rss setting report success, but failed to update the rss setting

Expected results:
The update should be forbid like:
error: Failed to update device from test.xml
error: Operation not supported: cannot modify virtio network device driver attributes

Additional info:

Comment 1 Michal Privoznik 2022-05-23 15:23:53 UTC
Patch proposed on the list:

https://listman.redhat.com/archives/libvir-list/2022-May/231715.html

Comment 2 Michal Privoznik 2022-05-24 07:03:02 UTC
Merged upstream as:

commit 2df6849d78f10cd47df9bc2a938583d933cb9e69
Author:     Michal Prívozník <mprivozn>
AuthorDate: Mon May 23 17:17:02 2022 +0200
Commit:     Michal Prívozník <mprivozn>
CommitDate: Tue May 24 09:02:00 2022 +0200

    qemu_hotplug: Deny changing @rss and @rss_hash_report attributes of virtio vNICs
    
    We have virDomainUpdateDeviceFlags() API that allows changing of
    some attributes of a device whilst domain is still running (e.g.
    setting different QoS, link state change on vNICs). But only very
    limited set of attributes can be changed and we have to check
    whether user isn't trying to sneak in a change that's not
    allowed. Well, in case of a virtio vNIC we forgot to check for
    @rss and @rss_hash_report attributes of <driver/>.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2082540
    Signed-off-by: Michal Privoznik <mprivozn>
    Reviewed-by: Laine Stump <laine>

v8.3.0-234-g2df6849d78

Comment 4 yalzhang@redhat.com 2022-05-30 02:57:56 UTC
Retest the scenarios in comment 0 with v8.4.0-rc1-12-ga5d9c70621, the bug is fixed.

# virsh update-device rhel test.xml
error: Failed to update device from test.xml
error: Operation not supported: cannot modify virtio network device driver attributes

Comment 7 yalzhang@redhat.com 2022-06-13 02:03:26 UTC
Test on libvirt-8.4.0-1.el9.x86_64

1. start vm with below interface settings:
# virsh dumpxml test | grep /interface -B8
    <interface type='network'>
      <mac address='52:54:00:a7:92:8e'/>
      <source network='default' portid='347fde93-490e-4432-89cd-8d3b7bf71518' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <driver queues='4'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </interface>

2.
# cat update1.xml 
    <interface type='network'>
      <mac address='52:54:00:a7:92:8e'/>
      <source network='default' portid='347fde93-490e-4432-89cd-8d3b7bf71518' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <driver queues='4' rss='on' rss_hash_report='on'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </interface>

# virsh update-device test update1.xml
error: Failed to update device from update1.xml
error: Operation not supported: cannot modify virtio network device driver attributes

3. 
# cat update2.xml 
    <interface type='network'>
      <mac address='52:54:00:a7:92:8e'/>
      <source network='default' portid='347fde93-490e-4432-89cd-8d3b7bf71518' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <driver queues='4' rss='off' rss_hash_report='off'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </interface>
# virsh update-device test update2.xml
error: Failed to update device from update2.xml
error: Operation not supported: cannot modify virtio network device driver attributes

4. start vm with below settings:
# virsh dumpxml test | grep /interface -B8
    <interface type='network'>
      <mac address='52:54:00:a7:92:8e'/>
      <source network='default' portid='2077f928-d787-4315-ba35-43f43a36ef35' bridge='virbr0'/>
      <target dev='vnet1'/>
      <model type='virtio'/>
      <driver queues='4' rss='on' rss_hash_report='on'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </interface>

# cat update3.xml 
    <interface type='network'>
      <mac address='52:54:00:a7:92:8e'/>
      <source network='default' portid='347fde93-490e-4432-89cd-8d3b7bf71518' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <driver queues='4' rss='off'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </interface>

# virsh update-device test update3.xml 
error: Failed to update device from update3.xml
error: Operation not supported: cannot modify virtio network device driver attributes

# virsh dumpxml test | grep /interface -B8
    <interface type='network'>
      <mac address='52:54:00:a7:92:8e'/>
      <source network='default' portid='2077f928-d787-4315-ba35-43f43a36ef35' bridge='virbr0'/>
      <target dev='vnet1'/>
      <model type='virtio'/>
      <driver queues='4' rss='on' rss_hash_report='on'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </interface>

the result is as expected.

Comment 9 errata-xmlrpc 2022-11-15 10:04:39 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 (Low: libvirt security, bug fix, and enhancement update), 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/RHSA-2022:8003

Comment 10 Mizar Zhou 2023-01-18 14:44:41 UTC
Thanks for the page, is there any solutions for changing queue of <driver/> ?