]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
addons: ethtool: FEC: translate None and NotSupported values to link-fec off
authorJulien Fortin <julien@cumulusnetworks.com>
Sat, 1 Dec 2018 01:16:01 +0000 (17:16 -0800)
committerJulien Fortin <julien@cumulusnetworks.com>
Thu, 13 Dec 2018 23:17:23 +0000 (15:17 -0800)
$ /sbin/ethtool --show-fec swp42
FEC parameters for swp42:
FEC encodings   : None
$ ifquery swp42
auto swp42
iface swp42
      link-fec off

$ ifreload -av |& grep ethtool
info: executing /sbin/ethtool swp42
info: executing /sbin/ethtool --show-fec swp42
$

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
ifupdown2/addons/ethtool.py

index dbf41961fbad8b4cb8c1eb0d9f054569dadb29db..3f1ea798d897fec8625bb950351e481edb33f8c6 100644 (file)
@@ -87,15 +87,17 @@ class ethtool(moduleBase,utilsBase):
             return
 
         # use only lowercase values
-        running_val = self.get_running_attr('fec', ifaceobj)
+        running_val = str(self.get_running_attr('fec', ifaceobj)).lower()
 
-        if running_val:
-            running_val = running_val.lower()
         if config_val:
             config_val = config_val.lower()
         if default_val:
             default_val = default_val.lower()
 
+        if running_val in ["none", "notsupported"]:
+            # None and NotSupported ethtool FEC values mean "off"
+            running_val = "off"
+
         # check running values
         if config_val and config_val == running_val:
             return