cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #03547
[Merge] ~raharper/cloud-init:add-netplan-bridge-stp into cloud-init:master
Ryan Harper has proposed merging ~raharper/cloud-init:add-netplan-bridge-stp into cloud-init:master.
Requested reviews:
cloud-init commiters (cloud-init-dev)
Related bugs:
Bug #1721157 in cloud-init: "netplan render drops bridge_stp setting"
https://bugs.launchpad.net/cloud-init/+bug/1721157
For more details, see:
https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/331755
netplan: render bridge stp boolean
Map network_state bridge parameter 'bridge_stp' value to
a boolean and set that value when rendering netplan.
LP: #1721157
--
Your team cloud-init commiters is requested to review the proposed merge of ~raharper/cloud-init:add-netplan-bridge-stp into cloud-init:master.
diff --git a/cloudinit/net/netplan.py b/cloudinit/net/netplan.py
index 3b06fbf..96c9cf9 100644
--- a/cloudinit/net/netplan.py
+++ b/cloudinit/net/netplan.py
@@ -318,6 +318,18 @@ class Renderer(renderer.Renderer):
(port, cost) = costval.split()
newvalue[port] = int(cost)
br_config.update({newname: newvalue})
+ elif newname == 'stp':
+ # map value to boolean
+ if value in [0, "off", "false"]:
+ newvalue = False
+ elif value in [1, "on", "true"]:
+ newvalue = True
+ else:
+ raise ValueError("netplan cannot convert bridge"
+ "stp value (%s) to boolean.",
+ value)
+ br_config.update({newname: newvalue})
+
if len(br_config) > 0:
bridge.update({'parameters': br_config})
_extract_addresses(ifcfg, bridge)
diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py
index 6faf01b..7de1be0 100644
--- a/cloudinit/net/network_state.py
+++ b/cloudinit/net/network_state.py
@@ -48,6 +48,7 @@ NET_CONFIG_TO_V2 = {
'bridge_maxwait': None,
'bridge_pathcost': 'path-cost',
'bridge_portprio': None,
+ 'bridge_stp': 'stp',
'bridge_waitport': None}}
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index f249615..93d7a6f 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -756,6 +756,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
eth3: 50
eth4: 75
priority: 22
+ stp: false
routes:
- to: ::/0
via: 2001:4800:78ff:1b::1
Follow ups