aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/impl_ifcfg.py
diff options
context:
space:
mode:
Diffstat (limited to 'os_net_config/impl_ifcfg.py')
-rw-r--r--os_net_config/impl_ifcfg.py42
1 files changed, 26 insertions, 16 deletions
diff --git a/os_net_config/impl_ifcfg.py b/os_net_config/impl_ifcfg.py
index 79e3e42..e8dbd46 100644
--- a/os_net_config/impl_ifcfg.py
+++ b/os_net_config/impl_ifcfg.py
@@ -63,7 +63,7 @@ class IfcfgNetConfig(os_net_config.NetConfig):
self.interface_data = {}
self.ivsinterface_data = {}
self.nfvswitch_intiface_data = {}
- self.nfvswitch_cpus = None
+ self.nfvswitch_options = None
self.vlan_data = {}
self.route_data = {}
self.route6_data = {}
@@ -113,6 +113,8 @@ 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:
@@ -262,6 +264,9 @@ 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 base_opt.mtu:
data += "MTU=%i\n" % base_opt.mtu
@@ -313,24 +318,29 @@ class IfcfgNetConfig(os_net_config.NetConfig):
data6 = ""
first_line6 = ""
for route in routes:
+ options = ""
+ if route.route_options:
+ options = " %s" % (route.route_options)
if ":" not in route.next_hop:
# Route is an IPv4 route
if route.default:
- first_line = "default via %s dev %s\n" % (route.next_hop,
- interface_name)
+ first_line = "default via %s dev %s%s\n" % (
+ route.next_hop, interface_name,
+ options)
else:
- data += "%s via %s dev %s\n" % (route.ip_netmask,
- route.next_hop,
- interface_name)
+ data += "%s via %s dev %s%s\n" % (
+ route.ip_netmask, route.next_hop,
+ interface_name, options)
else:
# Route is an IPv6 route
if route.default:
- first_line6 = "default via %s dev %s\n" % (route.next_hop,
- interface_name)
+ first_line6 = "default via %s dev %s%s\n" % (
+ route.next_hop, interface_name,
+ options)
else:
- data6 += "%s via %s dev %s\n" % (route.ip_netmask,
- route.next_hop,
- interface_name)
+ data6 += "%s via %s dev %s%s\n" % (
+ route.ip_netmask, route.next_hop,
+ interface_name, options)
self.route_data[interface_name] = first_line + data
self.route6_data[interface_name] = first_line6 + data6
logger.debug('route data: %s' % self.route_data[interface_name])
@@ -446,7 +456,7 @@ class IfcfgNetConfig(os_net_config.NetConfig):
is running, the nfvswitch virtual switch will be available.
:param bridge: The NfvswitchBridge object to add.
"""
- self.nfvswitch_cpus = bridge.cpus
+ self.nfvswitch_options = bridge.options
def add_bond(self, bond):
"""Add an OvsBond object to the net config object.
@@ -583,9 +593,9 @@ class IfcfgNetConfig(os_net_config.NetConfig):
nfvswitch_internal_ifaces):
"""Generate configuration content for nfvswitch."""
- cpu_str = ""
- if self.nfvswitch_cpus:
- cpu_str = " -c " + self.nfvswitch_cpus
+ options_str = ""
+ if self.nfvswitch_options:
+ options_str = self.nfvswitch_options
ifaces = []
for iface in nfvswitch_ifaces:
@@ -599,7 +609,7 @@ class IfcfgNetConfig(os_net_config.NetConfig):
ifaces.append(iface)
internal_str = ''.join(ifaces)
- data = ("SETUP_ARGS=\"%s%s%s\"" % (cpu_str, iface_str, internal_str))
+ data = "SETUP_ARGS=\"%s%s%s\"" % (options_str, iface_str, internal_str)
return data
def apply(self, cleanup=False, activate=True):