Unify ethtool options logic
Unify ethtool options logic between Interface, IbInterface and
SriovPF in ifcfg provider.
Change-Id: I9421586ff2474220b769989532e603c4db121611
(cherry picked from commit 115c36b892
)
This commit is contained in:
parent
683650abeb
commit
ffd2459020
|
@ -353,8 +353,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:
|
||||
|
@ -543,9 +541,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
|
||||
|
|
|
@ -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
|
||||
|
@ -1102,16 +1105,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):
|
||||
|
|
Loading…
Reference in New Issue