Bug 1165993

Summary: libvirt show the wrong network bandwidth when start with server or client type network
Product: Red Hat Enterprise Linux 7 Reporter: Luyao Huang <lhuang>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: dyuan, honzhang, mprivozn, mzhan, rbalakri
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.13-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 05:56:30 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 Luyao Huang 2014-11-20 08:31:17 UTC
Description of problem:
libvirt show the wrong network bandwidth when the vm start with server or client type network

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


How reproducible:
100%

Steps to Reproduce:

1.prepare 2 guest which have server and client interface:
# virsh dumpxml test5
    <interface type='server'>
      <mac address='52:54:00:22:c9:42'/>
      <source address='127.0.0.1' port='1234'/>
      <bandwidth>
        <inbound average='1' peak='1'/>
        <outbound average='1' peak='1'/>
      </bandwidth>
      <model type='rtl8139'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
    </interface>

# virsh dumpxml test3
    <interface type='server'>
      <mac address='52:54:00:22:c9:42'/>
      <source address='127.0.0.1' port='1234'/>
      <bandwidth>
        <inbound average='1' peak='1'/>
        <outbound average='1' peak='1'/>
      </bandwidth>
      <model type='rtl8139'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
    </interface>

2.start server first and then start client
 
3.scp a big thing from server to client (or client to server) and the speed is very fast(the same with doesn't set bandwidth) 

4.check it via domiftune,libvirt doesn't set network bandwidth for this type network, but still show it.

# virsh domiftune test5 52:54:00:22:c9:42  --live
inbound.average: 1
inbound.peak   : 1
inbound.burst  : 0
outbound.average: 1
outbound.peak  : 1
outbound.burst : 0

# virsh domiftune test3 52:54:00:97:6c:07  --live
inbound.average: 1
inbound.peak   : 1
inbound.burst  : 0
outbound.average: 1
outbound.peak  : 1
outbound.burst : 0

Actual results:

libvirt cannot do domiftune to a server and client guest interface, but still can check it and show the wrong bandwidth(which doesn't set)

Expected results:

report error or warning in log when try to start the guest, or cannot see it in running guest xml, because libvirt doesn't set it and cannot use tc set the bandwidth now, so do not show the wrong number in xml and domiftune.

# virsh domiftune test3 52:54:00:97:6c:07  --live
inbound.average: 0
inbound.peak   : 0
inbound.burst  : 0
outbound.average: 0
outbound.peak  : 0
outbound.burst : 0


Additional info:

cannot set bandwidth for this type network 

# virsh domiftune test3 52:54:00:97:6c:07 123
error: Unable to set interface parameters
error: internal error: Child process (/sbin/tc qdisc add dev) unexpected exit status 255: Command line is not complete. Try option "help"

Comment 1 Michal Privoznik 2015-01-08 14:46:33 UTC
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2015-January/msg00169.html

Comment 2 Michal Privoznik 2015-01-13 18:02:17 UTC
Another try:

https://www.redhat.com/archives/libvir-list/2015-January/msg00450.html

Comment 3 Michal Privoznik 2015-01-14 08:49:48 UTC
I've just pushed the patch upstream:

commit 04cf99a6b6ce380d4e04c726d1a7d4da40f908eb
Author:     Michal Privoznik <mprivozn>
AuthorDate: Wed Jan 7 15:52:21 2015 +0100
Commit:     Michal Privoznik <mprivozn>
CommitDate: Wed Jan 14 08:54:49 2015 +0100

    qemu, lxc: Warn if setting QoS on unsupported vNIC types
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1165993
    
    So, there are still plenty of vNIC types that we don't know how to set
    bandwidth on. Let's warn explicitly in case user has requested it
    instead of pretending everything was set.
    
    Signed-off-by: Michal Privoznik <mprivozn>

v1.2.11-156-g04cf99a

Although, we can't just forbid starting a VM with bandwidth set on unsupported interface. It would be a regression - there already may be a customer having a start hook set up, which injects the correct TC rules for unsupported interfaces. If we forbid starting such machine, then it would be a regression.

Comment 5 hongming 2015-07-06 08:35:40 UTC
Verify it as follows. 

# rpm -q libvirt
libvirt-1.2.17-1.el7.x86_64

# virsh start rhel7.0
Domain rhel7.0 started

# virsh domiflist rhel7.0
Interface  Type       Source     Model       MAC
-------------------------------------------------------
vnet3      network    default    virtio      52:54:00:68:ce:60
-          server     -          rtl8139     52:54:00:22:c9:42

# virsh domiftune rhel7.0 52:54:00:22:c9:42 --live
inbound.average: 1
inbound.peak   : 1
inbound.burst  : 0
outbound.average: 1
outbound.peak  : 1
outbound.burst : 0

# vim /var/log/libvirt/libvirtd.log

2015-07-06 08:20:23.581+0000: 9515: warning : qemuBuildInterfaceCommandLine:8432 : setting bandwidth on interfaces of type 'server' is not implemented yet

Comment 6 hongming 2015-07-06 08:48:07 UTC
Add hotplug scenario as follows.

# virsh start rhel7.0
Domain rhel7.0 started

# virsh domiflist rhel7.0
Interface  Type       Source     Model       MAC
-------------------------------------------------------
vnet3      network    default    virtio      52:54:00:68:ce:60

# cat if.xml
<interface type='server'>
      <mac address='52:54:00:22:c9:42'/>
      <source address='127.0.0.1' port='1234'/>
      <bandwidth>
        <inbound average='1' peak='1'/>
        <outbound average='1' peak='1'/>
      </bandwidth>
      <model type='rtl8139'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
</interface>

# virsh attach-device rhel7.0 if.xml
Device attached successfully

# virsh domiflist rhel7.0
Interface  Type       Source     Model       MAC
-------------------------------------------------------
vnet3      network    default    virtio      52:54:00:68:ce:60
-          server     -          rtl8139     52:54:00:22:c9:42

# vim /var/log/libvirt/libvirtd.log

2015-07-06 08:44:03.231+0000: 9512: warning : qemuDomainAttachNetDevice:972 : setting bandwidth on interfaces of type 'server' is not implemented yet

Comment 8 errata-xmlrpc 2015-11-19 05:56:30 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/RHBA-2015-2202.html