Blob Blame History Raw
From c1465ed861233cf90a1cace4c41560cbd48a61b3 Mon Sep 17 00:00:00 2001
From: Dan Kenigsberg <danken@redhat.com>
Date: Fri, 1 Feb 2013 23:04:50 +0200
Subject: [PATCH 28/30] 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@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/11621
Reviewed-by: Antoni Segura Puimedon <asegurap@redhat.com>
Tested-by: Mike Kolesnik <mkolesni@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/11680
Tested-by: Antoni Segura Puimedon <asegurap@redhat.com>
---
 vdsm/configNetwork.py | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

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 @@ class ConfigWriter(object):
         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 @@ class ConfigWriter(object):
         _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)
-- 
1.8.1.2