Change in vdsm[master]: [WIP] bugfix: regression network qos

gvallare at redhat.com gvallare at redhat.com
Tue Jul 23 09:17:20 UTC 2013


Giuseppe Vallarelli has uploaded a new change for review.

Change subject: [WIP] bugfix: regression network qos
......................................................................

[WIP] bugfix: regression network qos

Inbound and Outbound parameters are no longer dispatched
through the configurator when adding a network, this means
that configured network will not present the desired
QoS. See http://gerrit.ovirt.org/#/c/15724/17/vdsm/configNetwork.py

* Patchset 1 - Improving a previously defined functional test
               and verified that the current implementation make
               the updated test fail.

Change-Id: I306db7f04dd302f857dc263f3c536659aef5a161
Signed-off-by: Giuseppe Vallarelli <gvallare at redhat.com>
---
M tests/functional/networkTests.py
M tests/functional/utils.py
2 files changed, 40 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/17241/1

diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index ab79aa3..fc2b440 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -229,12 +229,16 @@
     @ValidateRunningAsRoot
     def testQosNetwork(self):
         with dummyIf(1) as nics:
-            qos = {'qosInbound': {'average': '1024', 'burst': '2048'},
+            qos = {'qosInbound': {'average': '1024', 'burst': '2048',
+                                  'peak': '42'},
                    'qosOutbound': {'average': '2400', 'burst': '2048',
                                    'peak': '100'}}
 
             status, msg = self.vdsm_net.addNetwork(NETWORK_NAME,
                                                    nics=nics,
                                                    opts=qos)
-
             self.assertEqual(status, SUCCESS, msg)
+
+            networkQos = self.vdsm_net.networkQos(NETWORK_NAME)
+            self.assertEqual(qos['qosInbound'], networkQos.inbound)
+            self.assertEqual(qos['qosOutbound'], networkQos.outbound)
diff --git a/tests/functional/utils.py b/tests/functional/utils.py
index f4a3d68..d6dceb9 100644
--- a/tests/functional/utils.py
+++ b/tests/functional/utils.py
@@ -16,20 +16,24 @@
 #
 # Refer to the README and COPYING files for full details of the license
 #
+from collections import namedtuple
 from contextlib import contextmanager
 from functools import wraps
 import random
 import time
 import threading
+from xml.dom import minidom
 
 from nose.plugins.skip import SkipTest
 
+from vdsm import libvirtconnection
 from vdsm import netinfo
 from vdsm import vdscli
 from vdsm import utils
 
 
 SUCCESS = 0
+Qos = namedtuple('Qos', 'inbound outbound')
 
 
 ip = utils.CommandPath('ip',
@@ -202,3 +206,33 @@
             raise
         finally:
             done = True
+
+    def networkQos(self, network):
+        cn = libvirtconnection.get()
+        networkXml = cn.networkLookupByName(netinfo.LIBVIRT_NET_PREFIX
+                                            + network).XMLDesc(0)
+
+        def createQosDict(elem):
+            qos_dict = {'average': elem.getAttribute('average'),
+                        'burst': elem.getAttribute('burst'),
+                        'peak': elem.getAttribute('peak')}
+            return qos_dict
+
+        qos = Qos(None, None)
+
+        doc = minidom.parseString(networkXml)
+        bandwidthElem = doc.getElementsByTagName('bandwidth')
+        if bandwidthElem:
+            inboundElem = bandwidthElem[0].getElementsByTagName('inbound')
+            outboundElem = bandwidthElem[0].getElementsByTagName('outbound')
+            if inboundElem:
+                inbound = createQosDict(inboundElem[0])
+            else:
+                inbound = None
+            if outboundElem:
+                outbound = createQosDict(outboundElem[0])
+            else:
+                outbound = None
+            qos = Qos(inbound, outbound)
+
+        return qos


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I306db7f04dd302f857dc263f3c536659aef5a161
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