Mark Wu has uploaded a new change for review.

Change subject: Change getMaxMtu to use the info provided by sysfs
......................................................................

Change getMaxMtu to use the info provided by sysfs

This could make the code reused by the other implementation of network
configuration.

Change-Id: I89d007eb81c2c64e642ed80af26f882f7632dc1c
Signed-off-by: Mark Wu <[email protected]>
---
M vdsm/configNetwork.py
M vdsm/netinfo.py
2 files changed, 10 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/11357/1

diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 4dccabf..bd5fa9d 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -611,28 +611,6 @@
             f.writelines(entries)
             f.close()
 
-    def getMaxMtu(self, nics, mtu):
-        """
-        Get the max MTU value from configuration/parameter
-
-        :param nics: list of nics
-        :type nics: list
-
-        :param mtu: mtu value
-        :type mtu: integer
-
-        getMaxMtu return the highest value in a connection tree,
-        it check if a vlan, bond that have a higher mtu value
-        """
-        for nic in nics:
-            cf = netinfo.NET_CONF_PREF + nic
-            mtuval = self._getConfigValue(cf, 'MTU')
-            if not mtuval is None:
-                mtuval = int(mtuval)
-                if mtuval > mtu:
-                    mtu = mtuval
-        return mtu
-
     def setNewMtu(self, network, bridged):
         """
         Set new MTU value to network and its interfaces
@@ -928,7 +906,7 @@
 
     prevmtu = None
     if mtu:
-        prevmtu = configWriter.getMaxMtu(nics, mtu)
+        prevmtu = netinfo.getMaxMtu(nics)
 
     nic = nics[0] if nics else None
     iface = bonding or nic
diff --git a/vdsm/netinfo.py b/vdsm/netinfo.py
index c8496db..0983a7e 100644
--- a/vdsm/netinfo.py
+++ b/vdsm/netinfo.py
@@ -122,6 +122,15 @@
     return mtu
 
 
+def getMaxMtu(nics):
+    maxMtu = int(getMtu(nics[0]))
+    for nic in nics[1:]:
+        mtu = int(getMtu(nics[0]))
+        if mtu > maxMtu:
+            maxMtu = mtu
+    return maxMtu
+
+
 def bridge_stp_state(bridge):
     stp = file('/sys/class/net/%s/bridge/stp_state' % bridge).readline()
     if stp == '1\n':


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I89d007eb81c2c64e642ed80af26f882f7632dc1c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to