Network quotas are ignored by libvirt when Open vSwitch is used

Bug #1254664 reported by Victor Stinner
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Victor Stinner

Bug Description

I created a flavor with quotas on the network bandwidth and created a VM with this flavor: upload limited 1 MB/sec, download limited to 500 kB/sec. The limits are ignored: copy from DevStack to the VM is faster than 13 MB/sec.

I'm using Neutron with Open vSwitch (OVS) for the network.

It looks like a regression in nova/virt/libvirt/vif.py. According to a colleague, it was maybe introduced when the OVS, LinuxBridge and HyperV classes were merged into one LibvirtGenericVIFDriver class. designer.set_vif_bandwidth_config() is only called for bridge types:

- get_config_ovs_hybrid()
- get_config_ivs_hybrid()
- network_model.VIF_TYPE_BRIDGE

Command to create the flavor and create a VM with this flavor:
---
nova flavor-create --ephemeral=1 victor_test_vif 50 256 1 1
nova flavor-key victor_test_vif set quota:vif_inbound_average=1000
nova flavor-key victor_test_vif set quota:vif_inbound_peak=1000
nova flavor-key victor_test_vif set quota:vif_outbound_peak=500
nova flavor-key victor_test_vif set quota:vif_outbound_average=500
nova boot --flavor=victor_test_vif --image=cirros-0.3.1-x86_64-uec victor_test
---

Command to start a small and fast TCP server on DevStack, uploading a file of 10 MB:
---
ip netns
# copy the qrouter-xxx name
sudo ip netns exec qrouter-128db593-a0db-40c3-84c7-e6383d40c75f bash

# following commands are executed in the qrouter namespace to reach the VM network
dd if=/dev/urandom of=random10MB bs=1024 count=10240
nc -l 0.0.0.0 12345 < random
---

Command to download the file on the VM:
---
time nc 10.0.0.1 12345 > /dev/null
---

Current result: timing smaller than 1 second (faster than 10 MB/sec)

Expected result: timing higher than 10 second (1 MB/sec or slower)

The problem is that the <bandwidth> tag is not generated in the libvirt.xml file of the VM.

I will provide a patch.

Tags: network
Changed in nova:
assignee: nobody → Victor Stinner (victor-stinner)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/58290

Changed in nova:
status: New → In Progress
Matt Riedemann (mriedem)
tags: added: network
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/58290
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=497bdfec93d696c7200a71b85a0680d99ce07bb9
Submitter: Jenkins
Branch: master

commit 497bdfec93d696c7200a71b85a0680d99ce07bb9
Author: Victor Stinner <email address hidden>
Date: Fri Nov 22 17:47:05 2013 +0100

    Fix LibvirtGenericVIFDriver.get_config() for quota

    When Nova is used with Neutron and Open vSwitch, network quotas on the
    bandwidth are ignored by libvirt: the "<bandwidth>" tag is not generated in
    libvirt.xml of the virtual machine. This change fixes this issue but also for
    the network types: "bridge", "network" and "direct".

    Commands to create the flavor with download limited to 1 MB/sec and create a
    virtual machine with this flavor:
    ---
    nova flavor-create --ephemeral=1 victor_test_vif 50 256 1 1
    nova flavor-key victor_test_vif set quota:vif_inbound_average=1000
    nova boot --flavor=victor_test_vif --image=cirros-0.3.1-x86_64-uec victor_test
    ---

    Commands to upload a file to this virtual machine with SCP to check that the
    bandwidth is limited to 1 MB/sec (replace 10.0.0.3 with the IP of the virtual
    machine):
    ---
    ip netns
    sudo ip netns exec qrouter-128db593-a0db-40c3-84c7-e6383d40c75f bash

    dd if=/dev/urandom of=random10MB bs=1024 count=10240
    scp random10M cirros@10.0.3:
    ---

    Change-Id: I0f0111fc79fe90900e38df022034b208f1129088
    Closes-Bug: #1254664

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → icehouse-2
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-2 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.