Change in vdsm[master]: Extract helper functions to update nic and bonding's mtu
wudxw at linux.vnet.ibm.com
wudxw at linux.vnet.ibm.com
Mon May 20 03:30:36 UTC 2013
Mark Wu has uploaded a new change for review.
Change subject: Extract helper functions to update nic and bonding's mtu
......................................................................
Extract helper functions to update nic and bonding's mtu
Change-Id: Ic82b1d9a27492619548f1c7ba3fced79ee68a1a8
Signed-off-by: Mark Wu <wudxw at linux.vnet.ibm.com>
---
M vdsm/configNetwork.py
M vdsm/netconf/ifcfg.py
2 files changed, 13 insertions(+), 16 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/14871/1
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index ea749da..2543055 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -376,14 +376,8 @@
elif not bonding:
_removeUnusedNics(network, vlan, bonding, nics, configWriter)
elif not _netinfo.bondingOtherUsers(network, vlan, bonding):
- # update MTU for bond interface and underlying NICs
ifdown(bonding)
- cf = netinfo.NET_CONF_PREF + bonding
- configWriter._updateConfigValue(cf, 'MTU', DEFAULT_MTU, False)
- for nic in nics:
- cf = netinfo.NET_CONF_PREF + nic
- configWriter._updateConfigValue(cf, 'MTU', DEFAULT_MTU, False)
-
+ configWriter.setBondingMtu(bonding, DEFAULT_MTU)
ifup(bonding)
diff --git a/vdsm/netconf/ifcfg.py b/vdsm/netconf/ifcfg.py
index 0855335..faf8108 100644
--- a/vdsm/netconf/ifcfg.py
+++ b/vdsm/netconf/ifcfg.py
@@ -630,6 +630,16 @@
f.writelines(entries)
f.close()
+ def setIfaceMtu(self, iface, newmtu):
+ cf = netinfo.NET_CONF_PREF + iface
+ self._updateConfigValue(cf, 'MTU', str(newmtu), False)
+
+ def setBondingMtu(self, bonding, newmtu):
+ self.setIfaceMtu(bonding, newmtu)
+ slaves = netinfo.slaves(bonding)
+ for slave in slaves:
+ self.setIfaceMtu(slave, newmtu)
+
def setNewMtu(self, network, bridged, _netinfo=None):
"""
Set new MTU value to network and its interfaces
@@ -679,16 +689,9 @@
# Optimization: if network hasn't custom MTU (currmtu), do nothing
if currmtu and newmtu != currmtu:
if bonding:
- cf = netinfo.NET_CONF_PREF + bonding
- self._updateConfigValue(cf, 'MTU', str(newmtu), newmtu is None)
- slaves = netinfo.slaves(bonding)
- for slave in slaves:
- cf = netinfo.NET_CONF_PREF + slave
- self._updateConfigValue(cf, 'MTU', str(newmtu),
- newmtu is None)
+ self.setBondingMtu(bonding, newmtu)
else:
- cf = netinfo.NET_CONF_PREF + nics[0]
- self._updateConfigValue(cf, 'MTU', str(newmtu), newmtu is None)
+ self.setIfaceMtu(nics[0], newmtu)
def ifdown(iface):
--
To view, visit http://gerrit.ovirt.org/14871
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic82b1d9a27492619548f1c7ba3fced79ee68a1a8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw at linux.vnet.ibm.com>
More information about the vdsm-patches
mailing list