Merge "Debian interface config set bond once"

This commit is contained in:
Zuul 2018-09-27 20:09:23 +00:00 committed by Gerrit Code Review
commit 9f629b8531
2 changed files with 10 additions and 23 deletions

View File

@ -833,21 +833,8 @@ def write_debian_interfaces(interfaces, sys_interfaces):
result += " vlan-raw-device {0}\n".format(vlan_raw_device)
result += " hw-mac-address {0}\n".format(
interface['mac_address'])
if 'bond_mode' in interface:
result += _write_debian_bond_conf(interface_name,
interface,
sys_interfaces)
elif interface['type'] == 'manual':
result += "iface {0} inet manual\n".format(interface_name)
if 'bond_master' in interface:
result += " bond-master {0}\n".format(
interface['bond_master'])
if 'bond_mode' in interface:
result += _write_debian_bond_conf(interface_name,
interface,
sys_interfaces)
else:
# Static ipv4 and ipv6
if interface['type'] == 'ipv6':
@ -862,13 +849,6 @@ def write_debian_interfaces(interfaces, sys_interfaces):
name=interface_name, link_type=link_type)
if vlan_raw_device:
result += " vlan-raw-device {0}\n".format(vlan_raw_device)
if 'bond_master' in interface:
result += " bond-master {0}\n".format(
interface['bond_master'])
if 'bond_mode' in interface:
result += _write_debian_bond_conf(interface_name,
interface,
sys_interfaces)
result += " address {0}\n".format(interface['ip_address'])
if interface['type'] == 'ipv4':
@ -903,6 +883,13 @@ def write_debian_interfaces(interfaces, sys_interfaces):
result += route_del.format(
net=route['network'], mask=_netmask,
gw=route['gateway'], interface=interface_name)
if 'bond_master' in interface:
result += " bond-master {0}\n".format(
interface['bond_master'])
if 'bond_mode' in interface:
result += _write_debian_bond_conf(interface_name,
interface,
sys_interfaces)
files_to_write[iface_path] = result
# Configure any interfaces not mentioned in the config drive data for DHCP.

View File

@ -76,6 +76,9 @@ iface bond1.27 inet dhcp
### Write /etc/network/interfaces.d/bond2.cfg
auto bond2
iface bond2 inet static
address 192.0.2.2
netmask 255.255.255.0
gateway 192.0.2.1
hwaddress bc:76:4e:05:7b:17
bond-mode 802.3ad
bond-miimon 100
@ -84,9 +87,6 @@ iface bond2 inet static
bond-slaves none
post-up ifenslave bond2 eth9 eth10
pre-down ifenslave -d bond2 eth9 eth10
address 192.0.2.2
netmask 255.255.255.0
gateway 192.0.2.1
### Write /etc/resolv.conf
nameserver 72.3.128.241
nameserver 72.3.128.240