[lxc-devel] [lxd/master] Network: Don't fill default config when doing an update
tomponline on Github
lxc-bot at linuxcontainers.org
Thu Nov 26 09:31:00 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 483 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201126/ace21b93/attachment.bin>
-------------- next part --------------
From 1e5a150f30683127ef6e2b6901e6d098c7010d97 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Thu, 26 Nov 2020 09:29:28 +0000
Subject: [PATCH] lxd/network/driver/bridge: Don't fill default config when
doing an update
This allows for ipv4.address and ipv6.address settings to be removed and have the effect of "none" rather than "auto".
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/network/driver_bridge.go | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/lxd/network/driver_bridge.go b/lxd/network/driver_bridge.go
index a3260e056a..71cde3f7dc 100644
--- a/lxd/network/driver_bridge.go
+++ b/lxd/network/driver_bridge.go
@@ -193,7 +193,8 @@ func (n *bridge) Validate(config map[string]string) error {
},
"ipv4.address": func(value string) error {
- if validate.IsOneOf(value, []string{"none", "auto"}) == nil {
+ // Empty is equivalent to "none".
+ if validate.IsOneOf(value, []string{"", "none", "auto"}) == nil {
return nil
}
@@ -214,7 +215,8 @@ func (n *bridge) Validate(config map[string]string) error {
"ipv4.ovn.ranges": validate.Optional(validate.IsNetworkRangeV4List),
"ipv6.address": func(value string) error {
- if validate.IsOneOf(value, []string{"none", "auto"}) == nil {
+ // Empty is equivalent to "none".
+ if validate.IsOneOf(value, []string{"", "none", "auto"}) == nil {
return nil
}
@@ -1524,12 +1526,6 @@ func (n *bridge) Stop() error {
func (n *bridge) Update(newNetwork api.NetworkPut, targetNode string, clientType cluster.ClientType) error {
n.logger.Debug("Update", log.Ctx{"clientType": clientType, "newNetwork": newNetwork})
- // Populate default values if they are missing.
- err := n.FillConfig(newNetwork.Config)
- if err != nil {
- return err
- }
-
dbUpdateNeeeded, changedKeys, oldNetwork, err := n.common.configChanged(newNetwork)
if err != nil {
return err
More information about the lxc-devel
mailing list