[lxc-devel] [lxd/master] client: Optimize copies on same nodes

stgraber on Github lxc-bot at linuxcontainers.org
Fri Mar 29 22:44:20 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 540 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190329/dd1205ee/attachment.bin>
-------------- next part --------------
From 8ca4f403ad1f7007225438d9907d27c4d70261b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 29 Mar 2019 18:43:15 -0400
Subject: [PATCH] client: Optimize copies on same nodes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

If the user requests that a container be copied on the same node that it
currently resides on, skip using the migration API and just use the
local copy API instead.

Closes #5613

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 client/lxd_containers.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/client/lxd_containers.go b/client/lxd_containers.go
index 8e2aee0de1..a0668dcee2 100644
--- a/client/lxd_containers.go
+++ b/client/lxd_containers.go
@@ -355,7 +355,7 @@ func (r *ProtocolLXD) CopyContainer(source ContainerServer, container api.Contai
 	}
 
 	// Optimization for the local copy case
-	if destInfo.URL == sourceInfo.URL && !r.IsClustered() {
+	if destInfo.URL == sourceInfo.URL && (!r.IsClustered() || container.Location == r.clusterTarget) {
 		// Project handling
 		if destInfo.Project != sourceInfo.Project {
 			if !r.HasExtension("container_copy_project") {


More information about the lxc-devel mailing list