The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/3743

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) ===
Signed-off-by: Stéphane Graber <[email protected]>
From 4310ac962db40723a74529b00b4cd3f8ea94451d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <[email protected]>
Date: Wed, 30 Aug 2017 14:39:16 -0400
Subject: [PATCH] lxd/images: Fix private image copy with partial fp
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <[email protected]>
---
 lxd/daemon_images.go | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/lxd/daemon_images.go b/lxd/daemon_images.go
index d76e3209c..06bb5fd4a 100644
--- a/lxd/daemon_images.go
+++ b/lxd/daemon_images.go
@@ -522,6 +522,23 @@ func (d *Daemon) ImageDownload(op *operation, server 
string, protocol string, ce
        // Image is in the DB now, don't wipe on-disk files on failure
        failure = false
 
+       // Check if the image path changed (private images)
+       newDestName := filepath.Join(destDir, fp)
+       if newDestName != destName {
+               err = shared.FileMove(destName, newDestName)
+               if err != nil {
+                       return nil, err
+               }
+
+               if shared.PathExists(destName + ".rootfs") {
+                       err = shared.FileMove(destName+".rootfs", 
newDestName+".rootfs")
+                       if err != nil {
+                               return nil, err
+                       }
+               }
+       }
+
+       // Record the image source
        if alias != fp {
                id, _, err := db.ImageGet(d.db, fp, false, true)
                if err != nil {
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to