Change in vdsm[ovirt-3.2]: configNet: allow delete/update of devices with no ifcfg

danken at redhat.com danken at redhat.com
Mon Feb 4 12:26:30 UTC 2013


Hello Mike Kolesnik, Antoni Segura Puimedon,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/11680

to review the following change.

Change subject: configNet: allow delete/update of devices with no ifcfg
......................................................................

configNet: allow delete/update of devices with no ifcfg

In Fedora 18, ifcfg files are missing by default. This patch assumes
that there are no custom MTU setting for a device with no ifcfg file.

This version of the patch owes a lot to Mark Wu's
http://gerrit.ovirt.org/11357 and to Toni who convinced me that it is
better to read the MTU directly from kernel.

Change-Id: Icb3a623ca3d3b560288cbe4141eea6bd060ac798
Bug-Url: https://bugzilla.redhat.com/906383
Signed-off-by: Dan Kenigsberg <danken at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/11621
Reviewed-by: Antoni Segura Puimedon <asegurap at redhat.com>
Tested-by: Mike Kolesnik <mkolesni at redhat.com>
---
M vdsm/configNetwork.py
1 file changed, 5 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/80/11680/1

diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 53debfa..041e1a4 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -600,12 +600,10 @@
         it check if a vlan, bond that have a higher mtu value
         """
         for nic in nics:
-            cf = self.NET_CONF_PREF + nic
-            mtuval = self._getConfigValue(cf, 'MTU')
-            if not mtuval is None:
-                mtuval = int(mtuval)
-                if mtuval > mtu:
-                    mtu = mtuval
+            mtuval = int(netinfo.getMtu(nic))
+
+            if mtuval > mtu:
+                mtu = mtuval
         return mtu
 
     def setNewMtu(self, network, bridged):
@@ -623,13 +621,7 @@
         _netinfo = netinfo.NetInfo()
         currmtu = None
         if bridged:
-            cf = self.NET_CONF_PREF + network
-            currmtu = self._getConfigValue(cf, 'MTU')
-            if currmtu:
-                currmtu = int(currmtu)
-            else:
-                # Optimization: if network hasn't custom MTU, do nothing
-                return
+            currmtu = int(netinfo.getMtu(network))
 
         nics, delvlan, bonding = \
             _netinfo.getNicsVlanAndBondingForNetwork(network)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb3a623ca3d3b560288cbe4141eea6bd060ac798
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.2
Gerrit-Owner: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Mike Kolesnik <mkolesni at redhat.com>


More information about the vdsm-patches mailing list