The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/8192

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
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.parr...@canonical.com>
From 1e5a150f30683127ef6e2b6901e6d098c7010d97 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@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.parr...@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
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to