The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7114
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) ===
From 62be5451130a7bb0073a6617373ee11878c923d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Tue, 31 Mar 2020 19:59:18 -0400 Subject: [PATCH 1/2] doc/instances: Fix escaping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- doc/instances.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/instances.md b/doc/instances.md index 4ca969e3dd..8305efe943 100644 --- a/doc/instances.md +++ b/doc/instances.md @@ -473,10 +473,10 @@ mtu | integer | parent MTU | no | The MTU of hwaddr | string | randomly assigned | no | The MAC address of the new interface ipv4.address | string | - | no | Comma delimited list of IPv4 static addresses to add to the instance ipv4.gateway | string | auto | no | Whether to add an automatic default IPv4 gateway, can be "auto" or "none" -ipv4.host_address | string | 169.254.0.1 | no | The IPv4 address to add to the host-side veth interface. +ipv4.host\_address | string | 169.254.0.1 | no | The IPv4 address to add to the host-side veth interface. ipv6.address | string | - | no | Comma delimited list of IPv6 static addresses to add to the instance ipv6.gateway | string | auto | no | Whether to add an automatic default IPv6 gateway, can be "auto" or "none" -ipv6.host_address | string | fe80::1 | no | The IPv6 address to add to the host-side veth interface. +ipv6.host\_address | string | fe80::1 | no | The IPv6 address to add to the host-side veth interface. vlan | integer | - | no | The VLAN ID to attach to #### bridged, macvlan or ipvlan for connection to physical network From 98eb61e85fdc73079d404d7ffd8b6b379d8d46ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Tue, 31 Mar 2020 22:29:32 -0400 Subject: [PATCH 2/2] lxd/networks: Fix clustered configs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/networks.go | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/lxd/networks.go b/lxd/networks.go index f5caebe95b..5d9c6eff6e 100644 --- a/lxd/networks.go +++ b/lxd/networks.go @@ -209,28 +209,18 @@ func networksPost(d *Daemon, r *http.Request) response.Response { } func networksPostCluster(d *Daemon, req api.NetworksPost) error { + logger.Errorf("here") + // Check that no node-specific config key has been defined. for key := range req.Config { if shared.StringInSlice(key, db.NetworkNodeConfigKeys) { return fmt.Errorf("Config key '%s' is node-specific", key) } } - - // Merge the current config. - networkID, dbNetwork, err := d.cluster.NetworkGet(req.Name) - if err != nil { - return err - } - - for k, v := range dbNetwork.Config { - _, ok := req.Config[k] - if !ok { - req.Config[k] = v - } - } + logger.Errorf("here1") // Add default values. - err = network.FillConfig(&req) + err := network.FillConfig(&req) if err != nil { return err } @@ -239,7 +229,14 @@ func networksPostCluster(d *Daemon, req api.NetworksPost) error { // configs and insert the global config. var configs map[string]map[string]string var nodeName string + var networkID int64 err = d.cluster.Transaction(func(tx *db.ClusterTx) error { + // Fetch the network ID. + networkID, err = tx.NetworkID(req.Name) + if err != nil { + return err + } + // Fetch the node-specific configs. configs, err = tx.NetworkNodeConfigs(networkID) if err != nil { @@ -253,6 +250,8 @@ func networksPostCluster(d *Daemon, req api.NetworksPost) error { } // Insert the global config keys. + logger.Errorf("here3, req=%+v", req) + return tx.NetworkConfigAdd(networkID, 0, req.Config) }) if err != nil { @@ -267,10 +266,12 @@ func networksPostCluster(d *Daemon, req api.NetworksPost) error { for key, value := range configs[nodeName] { nodeReq.Config[key] = value } + logger.Errorf("here4 req=%+v", nodeReq) err = doNetworksCreate(d, nodeReq, false) if err != nil { return err } + logger.Errorf("here5") // Notify all other nodes to create the network. notifier, err := cluster.NewNotifier(d.State(), d.endpoints.NetworkCert(), cluster.NotifyAll) @@ -288,12 +289,13 @@ func networksPostCluster(d *Daemon, req api.NetworksPost) error { nodeReq.Config[key] = value } + logger.Errorf("here6 req=%+v", nodeReq) return client.CreateNetwork(nodeReq) }) errored := notifyErr != nil - // Finally update the storage network state. + // Finally update the network state. err = d.cluster.Transaction(func(tx *db.ClusterTx) error { if errored { return tx.NetworkErrored(req.Name)
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel