[lxc-devel] [lxd/master] lxd/db: Avoid un-needed query on container move
stgraber on Github
lxc-bot at linuxcontainers.org
Wed Nov 21 20:28:41 UTC 2018
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/20181121/6602eaef/attachment.bin>
-------------- next part --------------
From 08b527bc4088a2b0315b6f59ca19e62cd8df1097 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 21 Nov 2018 14:41:16 -0500
Subject: [PATCH] lxd/db: Avoid un-needed query on container move
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #5297
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/db/containers.go | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lxd/db/containers.go b/lxd/db/containers.go
index 0961f3c14a..512535fa52 100644
--- a/lxd/db/containers.go
+++ b/lxd/db/containers.go
@@ -441,6 +441,11 @@ func (c *ClusterTx) ContainerNodeMove(oldName, newName, newNode string) error {
}
}
+ // No need to update storage_volumes if the name is identical
+ if newName == oldName {
+ return nil
+ }
+
// Update the container's and snapshots' storage volume name (since this is ceph,
// there's a clone of the volume for each node).
count, err := c.NodesCount()
More information about the lxc-devel
mailing list