summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-04-15 15:13:07 -0400
committerScott Moser <smoser@ubuntu.com>2016-04-15 15:13:07 -0400
commit5039a08032fc40c9c72afbef90184dbd1af10918 (patch)
tree5cc07a8c962bb82a9a087ff55a0d9dbf82233ad4 /cloudinit
parent14053fc79737f6ec6904021f3f6cdfd262c3b17e (diff)
downloadvyos-cloud-init-5039a08032fc40c9c72afbef90184dbd1af10918.tar.gz
vyos-cloud-init-5039a08032fc40c9c72afbef90184dbd1af10918.zip
support and render control=manual on initramfs network devices
when reading the initramfs configurewd devices and turning them into network config, we change to not have 'auto' control (or allow=auto). The reason for this is that if the device was still up: a.) it would try to bring it up again (due to bug 1570142) b.) it would be brought down. 'b' is problematic if there is an iscsi or network root filesystem. Note, that ifupdown does now support 'no-auto-down' which means that the nic should not be brought down on 'ifdown -a'. LP: #1568637
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/net/__init__.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py
index 7a6ec3a4..647c595b 100644
--- a/cloudinit/net/__init__.py
+++ b/cloudinit/net/__init__.py
@@ -350,7 +350,7 @@ def _klibc_to_config_entry(content, mac_addrs=None):
# if no IPV4ADDR or IPV6ADDR, then go on.
if pre + "ADDR" not in data:
continue
- subnet = {'type': proto}
+ subnet = {'type': proto, 'control': 'manual'}
# these fields go right on the subnet
for key in ('NETMASK', 'BROADCAST', 'GATEWAY'):
@@ -444,12 +444,13 @@ def iface_add_subnet(iface, subnet):
def iface_add_attrs(iface):
content = ""
ignore_map = [
- 'type',
- 'name',
+ 'control',
+ 'index',
'inet',
'mode',
- 'index',
+ 'name',
'subnets',
+ 'type',
]
if iface['type'] not in ['bond', 'bridge', 'vlan']:
ignore_map.append('mac_address')
@@ -540,6 +541,7 @@ def render_interfaces(network_state):
content += "\n"
iface['index'] = index
iface['mode'] = subnet['type']
+ iface['control'] = subnet.get('control', 'auto')
if iface['mode'].endswith('6'):
iface['inet'] += '6'
elif iface['mode'] == 'static' and ":" in subnet['address']:
@@ -548,11 +550,11 @@ def render_interfaces(network_state):
iface['mode'] = 'dhcp'
if index == 0:
- if subnet['type'] != 'manual':
- content += "auto {name}\n".format(**iface)
+ if iface['control'] != 'manual':
+ content += "allow-{control} {name}\n".format(**iface)
content += "iface {name} {inet} {mode}\n".format(**iface)
else:
- if subnet['type'] != 'manual':
+ if iface['control'] != 'manual':
content += "auto {name}:{index}\n".format(**iface)
content += \
"iface {name}:{index} {inet} {mode}\n".format(**iface)
@@ -560,6 +562,7 @@ def render_interfaces(network_state):
content += iface_add_subnet(iface, subnet)
content += iface_add_attrs(iface)
else:
+ # ifenslave docs say to auto the slave devices
if 'bond-master' in iface:
content += "auto {name}\n".format(**iface)
content += "iface {name} {inet} {mode}\n".format(**iface)