[lxc-devel] [lxd/master] lxd/networks: Fix ETag handling on clusters
stgraber on Github
lxc-bot at linuxcontainers.org
Wed May 22 20:25:58 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190522/c759a49c/attachment-0001.bin>
-------------- next part --------------
From 102822dcd405dd9b2e8a32d828dd521c16d15847 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 22 May 2019 16:15:46 -0400
Subject: [PATCH] lxd/networks: Fix ETag handling on clusters
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #5764
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/networks.go | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/lxd/networks.go b/lxd/networks.go
index d8545ce7a4..5ce5bfda11 100644
--- a/lxd/networks.go
+++ b/lxd/networks.go
@@ -582,6 +582,20 @@ func networkPut(d *Daemon, r *http.Request) Response {
return SmartError(err)
}
+ targetNode := queryParam(r, "target")
+ clustered, err := cluster.Enabled(d.db)
+ if err != nil {
+ return SmartError(err)
+ }
+
+ // If no target node is specified and the daemon is clustered, we omit
+ // the node-specific fields.
+ if targetNode == "" && clustered {
+ for _, key := range db.NetworkNodeConfigKeys {
+ delete(dbInfo.Config, key)
+ }
+ }
+
// Validate the ETag
etag := []interface{}{dbInfo.Name, dbInfo.Managed, dbInfo.Type, dbInfo.Description, dbInfo.Config}
@@ -607,6 +621,20 @@ func networkPatch(d *Daemon, r *http.Request) Response {
return SmartError(err)
}
+ targetNode := queryParam(r, "target")
+ clustered, err := cluster.Enabled(d.db)
+ if err != nil {
+ return SmartError(err)
+ }
+
+ // If no target node is specified and the daemon is clustered, we omit
+ // the node-specific fields.
+ if targetNode == "" && clustered {
+ for _, key := range db.NetworkNodeConfigKeys {
+ delete(dbInfo.Config, key)
+ }
+ }
+
// Validate the ETag
etag := []interface{}{dbInfo.Name, dbInfo.Managed, dbInfo.Type, dbInfo.Description, dbInfo.Config}
More information about the lxc-devel
mailing list