Merge "Unify ethtool options logic" into stable/queens

This commit is contained in:
Zuul 2019-06-11 10:04:31 +00:00 committed by Gerrit Code Review
commit 56b837201b
2 changed files with 7 additions and 15 deletions

View File

@ -374,8 +374,6 @@ class IfcfgNetConfig(os_net_config.NetConfig):
data += "TYPE=NFVSWITCHIntPort\n"
elif isinstance(base_opt, objects.IbInterface):
data += "TYPE=Infiniband\n"
if base_opt.ethtool_opts:
data += "ETHTOOL_OPTS=\"%s\"\n" % base_opt.ethtool_opts
elif re.match('\w+\.\d+$', base_opt.name):
data += "VLAN=yes\n"
if base_opt.linux_bond_name:
@ -564,9 +562,8 @@ class IfcfgNetConfig(os_net_config.NetConfig):
data += "BOOTPROTO=dhcp\n"
elif not base_opt.addresses:
data += "BOOTPROTO=none\n"
if isinstance(base_opt, objects.Interface):
if base_opt.ethtool_opts:
data += "ETHTOOL_OPTS=\"%s\"\n" % base_opt.ethtool_opts
if hasattr(base_opt, 'ethtool_opts') and base_opt.ethtool_opts:
data += "ETHTOOL_OPTS=\"%s\"\n" % base_opt.ethtool_opts
if base_opt.mtu:
data += "MTU=%i\n" % base_opt.mtu

View File

@ -144,6 +144,9 @@ PEERDNS=no
TYPE=Infiniband
"""
_IB_IFCFG = _BASE_IB_IFCFG + """BOOTPROTO=none
"""
_V4_IB_IFCFG = _BASE_IB_IFCFG + """BOOTPROTO=static
IPADDR=192.168.1.2
NETMASK=255.255.255.0
@ -1164,16 +1167,8 @@ ETHTOOL_OPTS=\"speed 1000 duplex full\"
def test_ib_interface_ethtool_opts(self):
ifc = objects.IbInterface('ib0', ethtool_opts='speed 1000 duplex full')
self.provider.add_interface(ifc)
ib_config = """# This file is autogenerated by os-net-config
DEVICE=ib0
ONBOOT=yes
HOTPLUG=no
NM_CONTROLLED=no
PEERDNS=no
TYPE=Infiniband
ETHTOOL_OPTS=\"speed 1000 duplex full\"
BOOTPROTO=none
"""
ib_config = "".join((_IB_IFCFG,
"ETHTOOL_OPTS=\"speed 1000 duplex full\"\n"))
self.assertEqual(ib_config, self.get_interface_config('ib0'))
def test_interface_single_dns_server(self):