Bug 1029732

Summary: Libvirt can not update/modify queues value of interface element using update-device command
Product: Red Hat Enterprise Linux 7 Reporter: Hu Jianwei <jiahu>
Component: libvirtAssignee: Laine Stump <laine>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: 963453867, dyuan, honzhang, lcheng, mzhan, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.7-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 07:25:49 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:
Embargoed:

Description Hu Jianwei 2013-11-13 03:16:42 UTC
Description of problem:
Libvirt can not update/modify queues value of interface element using update-device command

Version-Release number of selected component (if applicable):
libvirt-1.1.1-11.el7.x86_64
kernel-3.10.0-33.el7.x86_64
qemu-kvm-1.5.3-10.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Start a domain with interface and multi-queue enabled
[root@sriov2 ~]# virsh start r7
Domain r7 started

[root@sriov2 ~]# virsh dumpxml r7 |grep -aA8 interface
    <interface type='network'>
      <mac address='52:54:00:02:0a:7a'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <driver name='vhost' queues='2'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </interface>
...

2.Update the interface queue value using update-device
[root@sriov2 ~]# cat nic.xml
 <interface type='network'>
      <mac address='52:54:00:02:0a:7a'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
<driver name='vhost' queues='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </interface>

[root@sriov2 ~]#
[root@sriov2 ~]# virsh update-device r7 nic.xml --current
Device updated successfully

3. Check the results
[root@sriov2 ~]# virsh dumpxml r7 |grep -aA8 interface
    <interface type='network'>
      <mac address='52:54:00:02:0a:7a'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <driver name='vhost' queues='2'/>             <========the value was not updated
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </interface>
...


Actual results:
As step3

Expected results:
If this feature can be supported by update-device cmd, please do action accordingly, if not, I think libvirtd should pop up some error messages to refuse it.

For example, we replace the driver(vhost->qemu) using same command:
[root@sriov2 ~]# virsh dumpxml r7 | grep -aA8 interface
    <interface type='network'>
      <mac address='52:54:00:02:0a:7a'/>
      <source network='default'/>
      <target dev='vnet1'/>
      <model type='virtio'/>
      <driver name='vhost'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </interface>
...
[root@sriov2 ~]# vim nic.xml 
[root@sriov2 ~]# cat nic.xml 
<interface type='network'>
      <mac address='52:54:00:02:0a:7a'/>
      <source network='default'/>
      <target dev='vnet1'/>
      <model type='virtio'/>
      <driver name='qemu'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </interface>

[root@sriov2 ~]# virsh update-device r7 nic.xml --current
error: Failed to update device from nic.xml
error: Operation not supported: cannot modify virtio network device driver attributes

Comment 2 Laine Stump 2013-11-15 11:36:40 UTC
My understanding is that it *can't* be changed live (i.e. without hot-unplugging the device and plugging in a new device). The plumbing for a macvtap interface is more or less set in stone at the time the device is created.

For this reason, I think the only reasonable thing to do here is to log an error if someone tries to make a live change to the number of queues.

Comment 3 Laine Stump 2013-12-03 14:53:07 UTC
Fix pushed upstream:

commit 5e12641e0ea49fa1f0b4338f999ec63f41efec4c
Author: Laine Stump <laine>
Date:   Tue Dec 3 12:40:38 2013 +0200

    qemu: report error on attempt to live change virtio-net queues

Comment 7 lcheng 2014-11-17 09:50:19 UTC
Verify it as follows. The result is expected. 


Version:
libvirt-1.2.8-6.el7.x86_64
qemu-kvm-rhev-2.1.2-8.el7.x86_64
qemu-kvm-1.5.3-79.el7.x86_64


Steps:
# virsh start rhel7.0
Domain rhel7.0 started

# virsh dumpxml rhel7.0 |grep -aA8 interface
    <interface type='network'>
      <mac address='52:54:00:db:0c:00'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <driver name='vhost' queues='2'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
...

# cat nic.xml 
    <interface type='network'>
      <mac address='52:54:00:db:0c:00'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <driver name='vhost' queues='4'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

# virsh update-device rhel7.0 nic.xml --current
error: Failed to update device from nic.xml
error: Operation not supported: cannot modify virtio network device driver attributes

Comment 9 errata-xmlrpc 2015-03-05 07:25:49 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://rhn.redhat.com/errata/RHSA-2015-0323.html

Comment 10 qiufossen 2022-04-20 08:59:38 UTC
The domain is at running, can not update virtio-net queues living. The libvirt code as following:

  if (virDomainNetIsVirtioModel(olddev) &&
        (olddev->driver.virtio.name != newdev->driver.virtio.name ||
         olddev->driver.virtio.txmode != newdev->driver.virtio.txmode ||
         olddev->driver.virtio.ioeventfd != newdev->driver.virtio.ioeventfd ||
         olddev->driver.virtio.event_idx != newdev->driver.virtio.event_idx ||

         olddev->driver.virtio.queues != newdev->driver.virtio.queues ||

         olddev->driver.virtio.rx_queue_size != newdev->driver.virtio.rx_queue_size ||
         olddev->driver.virtio.tx_queue_size != newdev->driver.virtio.tx_queue_size ||
         olddev->driver.virtio.host.csum != newdev->driver.virtio.host.csum ||
         olddev->driver.virtio.host.gso != newdev->driver.virtio.host.gso ||
         olddev->driver.virtio.host.tso4 != newdev->driver.virtio.host.tso4 ||
         olddev->driver.virtio.host.tso6 != newdev->driver.virtio.host.tso6 ||
         olddev->driver.virtio.host.ecn != newdev->driver.virtio.host.ecn ||
         olddev->driver.virtio.host.ufo != newdev->driver.virtio.host.ufo ||
         olddev->driver.virtio.host.mrg_rxbuf != newdev->driver.virtio.host.mrg_rxbuf ||
         olddev->driver.virtio.guest.csum != newdev->driver.virtio.guest.csum ||
         olddev->driver.virtio.guest.tso4 != newdev->driver.virtio.guest.tso4 ||
         olddev->driver.virtio.guest.tso6 != newdev->driver.virtio.guest.tso6 ||
         olddev->driver.virtio.guest.ecn != newdev->driver.virtio.guest.ecn ||
         olddev->driver.virtio.guest.ufo != newdev->driver.virtio.guest.ufo)) {
        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                       _("cannot modify virtio network device driver attributes"));
        goto cleanup;