Change in vdsm[ovirt-3.3]: netconfig: set ETHTOOL_OPTS when a NIC goes up

danken at redhat.com danken at redhat.com
Tue Mar 25 18:05:14 UTC 2014


Dan Kenigsberg has uploaded a new change for review.

Change subject: netconfig: set ETHTOOL_OPTS when a NIC goes up
......................................................................

netconfig: set ETHTOOL_OPTS when a NIC goes up

There's broken hardware out there where lro needs to to be turned off
explicitly.
This patch lets an admin of a local node set

  ethtool_opts.eth0 = lro off

to disable LRO on the interface named eth0.

This patch includes a substantial fix based on
Iac6646bbad8c7431ec1c035ebc01f0180a8338ee by Antoni S. Puimedon.

Bug-Url: https://bugzilla.redhat.com/1059680
Change-Id: Ic8a5a933e1c93f80185d61f3cd43eee53c3a7c1a
Signed-off-by: Antoni S. Puimedon <asegurap at redhat.com>
Signed-off-by: Dan Kenigsberg <danken at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/23366
Reviewed-on: http://gerrit.ovirt.org/23792
Reviewed-on: http://gerrit.ovirt.org/23761
Reviewed-by: Yaniv Bronhaim <ybronhei at redhat.com>
---
M lib/vdsm/config.py.in
M vdsm/netconf/__init__.py
M vdsm/netconf/ifcfg.py
3 files changed, 21 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/92/26092/1

diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index 7d85232..afe2670 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -47,6 +47,12 @@
             'NetworkManager is disabled and device name persistence does '
             'not depend on HWADDR.'),
 
+        ('ethtool_opts', '',
+            'Which special ethtool options should be applied to NICs after '
+            'they are taken up, e.g. "lro off" on buggy devices. '
+            'To apply options to a single interface, '
+            'set ethtool_opts.iface_name.'),
+
         ('nic_model', 'rtl8139,pv',
             'NIC model is rtl8139, ne2k_pci pv or any other valid device '
             'recognized by kvm/qemu if a coma separated list given then a '
diff --git a/vdsm/netconf/__init__.py b/vdsm/netconf/__init__.py
index b614183..5520d01 100644
--- a/vdsm/netconf/__init__.py
+++ b/vdsm/netconf/__init__.py
@@ -17,12 +17,14 @@
 # Refer to the README and COPYING files for full details of the license
 #
 
+import ConfigParser
 import logging
 
 from netmodels import Bond, Bridge
 from sourceRoute import StaticSourceRoute
 from sourceRoute import DynamicSourceRoute
 from vdsm import netinfo
+from vdsm.config import config
 
 
 class Configurator(object):
@@ -120,3 +122,11 @@
             else:
                 self.configApplier.setIfaceMtu(iface.name, maxMtu)
         return maxMtu
+
+
+def getEthtoolOpts(name):
+    try:
+        opts = config.get('vars', 'ethtool_opts.' + name)
+    except ConfigParser.NoOptionError:
+        opts = config.get('vars', 'ethtool_opts')
+    return opts
diff --git a/vdsm/netconf/ifcfg.py b/vdsm/netconf/ifcfg.py
index 06bdba4..f823671 100644
--- a/vdsm/netconf/ifcfg.py
+++ b/vdsm/netconf/ifcfg.py
@@ -29,7 +29,7 @@
 import threading
 
 import dsaversion
-from netconf import Configurator
+from netconf import Configurator, getEthtoolOpts
 from neterrors import ConfigNetworkError
 from netmodels import Nic, Bridge, IpConfig
 from sourceRoute import DynamicSourceRoute
@@ -574,6 +574,10 @@
         if nic.bond:
             conf += 'MASTER=%s\nSLAVE=yes\n' % pipes.quote(nic.bond.name)
 
+        ethtool_opts = getEthtoolOpts(nic.name)
+        if ethtool_opts:
+            conf += 'ETHTOOL_OPTS=%s\n' % pipes.quote(ethtool_opts)
+
         ipconfig, mtu = self._getIfaceConfValues(nic, _netinfo)
         self._createConfFile(conf, nic.name, ipconfig, mtu, **opts)
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic8a5a933e1c93f80185d61f3cd43eee53c3a7c1a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.3
Gerrit-Owner: Dan Kenigsberg <danken at redhat.com>


More information about the vdsm-patches mailing list