Change in vdsm[master]: QoS feature: Adds bandwitdh elem to a network interface defi...

gvallare at redhat.com gvallare at redhat.com
Sat Jun 8 08:17:28 UTC 2013


Giuseppe Vallarelli has uploaded a new change for review.

Change subject: QoS feature: Adds bandwitdh elem to a network interface definition.
......................................................................

QoS feature: Adds bandwitdh elem to a network interface definition.

NetworkInterfaceDevice can now generate xml definition for shaping
incoming and outgoing traffic supported attributes are the following
ones: average, burst and peak.

Change-Id: Iec7c61d2713270dc8e46ee01f155e2ad54c748a5
Signed-off-by: Giuseppe Vallarelli <gvallare at redhat.com>
---
M tests/libvirtvmTests.py
M vdsm/vm.py
2 files changed, 25 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/15445/1

diff --git a/tests/libvirtvmTests.py b/tests/libvirtvmTests.py
index ccb8b26..118933b 100644
--- a/tests/libvirtvmTests.py
+++ b/tests/libvirtvmTests.py
@@ -350,12 +350,18 @@
                 <tune>
                     <sndbuf>0</sndbuf>
                 </tune>
+                <bandwidth>
+                    <inbound average="1000" burst="1024" peak="5000"/>
+                    <outbound average="128" burst="256" peak="256"/>
+                </bandwidth>
             </interface>""" % self.PCI_ADDR
 
         dev = {'nicModel': 'virtio', 'macAddr': '52:54:00:59:F5:3F',
                'network': 'ovirtmgmt', 'address': self.PCI_ADDR_DICT,
                'device': 'bridge', 'type': 'interface',
-               'bootOrder': '1', 'filter': 'no-mac-spoofing'}
+               'bootOrder': '1', 'filter': 'no-mac-spoofing',
+               'inbound': {'avg': '1000', 'peak': '5000', 'burst': '1024'},
+               'outbound': {'avg': '128', 'peak': '256', 'burst': '256'}}
 
         self.conf['custom'] = {'vhost': 'ovirtmgmt:true', 'sndbuf': '0'}
         iface = vm.NetworkInterfaceDevice(self.conf, self.log, **dev)
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 67328d2..4e4076e 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -1246,6 +1246,10 @@
             [<filterref filter='filter name'/>]
             [<tune><sndbuf>0</sndbuf></tune>]
             [<link state='up|down'/>]
+            [<bandwidth>
+              [<inbound average="int" [burst="int"]  [peak="int"]/>]
+              [<outbound average="int" [burst="int"]  [peak="int"]/>]
+             </bandwidth>]
         </interface>
         """
         iface = self.createXmlElem('interface', self.device, ['address'])
@@ -1270,6 +1274,20 @@
             tune = iface.appendChildWithArgs('tune')
             tune.appendChildWithArgs('sndbuf', text=self.sndbufParam)
 
+        if hasattr(self, 'inbound') or hasattr(self, 'outbound'):
+            bandwidth = self.createXmlElem('bandwidth', None)
+            # Inbound and Outbound traffic can be indipendently shaped.
+            if hasattr(self, 'inbound'):
+                bandwidth.appendChildWithArgs('inbound',
+                                              average=self.inbound['avg'],
+                                              burst=self.inbound.get('burst'),
+                                              peak=self.inbound.get('peak'))
+            if hasattr(self, 'outbound'):
+                bandwidth.appendChildWithArgs('outbound',
+                                              average=self.outbound['avg'],
+                                              burst=self.outbound.get('burst'),
+                                              peak=self.outbound.get('peak'))
+            iface.appendChild(bandwidth)
         return iface
 
 


--
To view, visit http://gerrit.ovirt.org/15445
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iec7c61d2713270dc8e46ee01f155e2ad54c748a5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Giuseppe Vallarelli <gvallare at redhat.com>


More information about the vdsm-patches mailing list