summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2017-05-13 01:45:23 +0100
committerScott Moser <smoser@brickies.net>2017-05-25 15:10:33 -0400
commit910ed46124e992eb20e49ea156b7127cd3ebbe9d (patch)
tree855f2db02f971028e1af1d8db366fd5063177219
parente5b2c011440aefe036c71a8c5e8ec547cc80f270 (diff)
downloadvyos-cloud-init-910ed46124e992eb20e49ea156b7127cd3ebbe9d.tar.gz
vyos-cloud-init-910ed46124e992eb20e49ea156b7127cd3ebbe9d.zip
nplan: For bonds, allow dashed or underscore names of keys.
As some of the bond paramemters are passed in as dashed, or underscored, depending on the input source. Also correct transmit-hash-policy netplan target key. LP: #1690480
-rw-r--r--cloudinit/net/netplan.py4
-rw-r--r--tests/unittests/test_net.py10
2 files changed, 12 insertions, 2 deletions
diff --git a/cloudinit/net/netplan.py b/cloudinit/net/netplan.py
index 9b71de97..d7ddf0c3 100644
--- a/cloudinit/net/netplan.py
+++ b/cloudinit/net/netplan.py
@@ -41,7 +41,7 @@ NET_CONFIG_TO_V2 = {
'bond-num-grat-arp': 'gratuitious-arp',
'bond-primary-reselect': 'primary-reselect-policy',
'bond-updelay': 'up-delay',
- 'bond-xmit_hash_policy': 'transmit_hash_policy'},
+ 'bond-xmit-hash-policy': 'transmit-hash-policy'},
'bridge': {'bridge_ageing': 'ageing-time',
'bridge_bridgeprio': 'priority',
'bridge_fd': 'forward-delay',
@@ -294,7 +294,7 @@ class Renderer(renderer.Renderer):
for match in ['bond_', 'bond-']:
bond_params = _get_params_dict_by_match(ifcfg, match)
for (param, value) in bond_params.items():
- newname = v2_bond_map.get(param)
+ newname = v2_bond_map.get(param.replace('_', '-'))
if newname is None:
continue
bond_config.update({newname: value})
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index 7104d00e..5169821a 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -483,11 +483,15 @@ auto eth1
iface eth1 inet manual
bond-master bond0
bond-mode active-backup
+ bond-xmit-hash-policy layer3+4
+ bond_miimon 100
auto eth2
iface eth2 inet manual
bond-master bond0
bond-mode active-backup
+ bond-xmit-hash-policy layer3+4
+ bond_miimon 100
iface eth3 inet manual
@@ -500,6 +504,8 @@ auto bond0
iface bond0 inet6 dhcp
bond-mode active-backup
bond-slaves none
+ bond-xmit-hash-policy layer3+4
+ bond_miimon 100
hwaddress aa:bb:cc:dd:ee:ff
auto br0
@@ -625,7 +631,9 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
- eth1
- eth2
parameters:
+ mii-monitor-interval: 100
mode: active-backup
+ transmit-hash-policy: layer3+4
bridges:
br0:
addresses:
@@ -716,6 +724,8 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
- eth2
params:
bond-mode: active-backup
+ bond_miimon: 100
+ bond-xmit-hash-policy: "layer3+4"
subnets:
- type: dhcp6
# A Bond VLAN.