[lxc-devel] [lxd/master] Fix issues with network API
stgraber on Github
lxc-bot at linuxcontainers.org
Fri Jul 20 00:01:06 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180720/dd83c6f5/attachment.bin>
-------------- next part --------------
From e341499f3fa46d9d5f18a5c6cf11e45a269b1a53 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 19 Jul 2018 19:55:05 -0400
Subject: [PATCH 1/2] lxd/db: Fix handling of NetworkConfigClear
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #4813
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/db/networks.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lxd/db/networks.go b/lxd/db/networks.go
index bbce83414..22a3b3980 100644
--- a/lxd/db/networks.go
+++ b/lxd/db/networks.go
@@ -542,7 +542,7 @@ func networkConfigAdd(tx *sql.Tx, networkID, nodeID int64, config map[string]str
// associated with the node with the given ID.
func NetworkConfigClear(tx *sql.Tx, networkID, nodeID int64) error {
_, err := tx.Exec(
- "DELETE FROM networks_config WHERE network_id=? AND node_id=?",
+ "DELETE FROM networks_config WHERE network_id=? AND (node_id=? OR node_id IS NULL)",
networkID, nodeID)
if err != nil {
return err
From 475b726f42478345af7f0b2e45e28a6993b62a14 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 19 Jul 2018 19:59:29 -0400
Subject: [PATCH 2/2] lxd/networks: Fix PATCH operations
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #4813
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/networks.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lxd/networks.go b/lxd/networks.go
index 388e9d439..115e4eea8 100644
--- a/lxd/networks.go
+++ b/lxd/networks.go
@@ -589,7 +589,7 @@ func networkPatch(d *Daemon, r *http.Request) Response {
// Get the existing network
_, dbInfo, err := d.cluster.NetworkGet(name)
- if dbInfo != nil {
+ if err != nil {
return SmartError(err)
}
More information about the lxc-devel
mailing list