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

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 726cc594bd60d03bdce041b89ab67e2b16cec725 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <[email protected]>
Date: Tue, 18 Jul 2017 14:21:43 +0200
Subject: [PATCH] Fix "lxc image copy" not recording the source
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <[email protected]>
---
 lxc/image.go | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/lxc/image.go b/lxc/image.go
index 6c0558504..fe6076e05 100644
--- a/lxc/image.go
+++ b/lxc/image.go
@@ -389,13 +389,26 @@ func (c *imageCmd) run(conf *config.Config, args 
[]string) error {
                        return err
                }
 
-               // Check if an alias
-               fingerprint := c.dereferenceAlias(d, inName)
+               // Optimisation for simplestreams
+               var imgInfo *api.Image
+               image := inName
+               if conf.Remotes[remote].Protocol == "simplestreams" {
+                       imgInfo = &api.Image{}
+                       imgInfo.Fingerprint = image
+                       imgInfo.Public = true
+               } else {
 
-               // Get the image
-               image, _, err := d.GetImage(fingerprint)
-               if err != nil {
-                       return err
+                       // Attempt to resolve an image alias
+                       alias, _, err := d.GetImageAlias(image)
+                       if err == nil {
+                               image = alias.Target
+                       }
+
+                       // Get the image info
+                       imgInfo, _, err = d.GetImage(image)
+                       if err != nil {
+                               return err
+                       }
                }
 
                // Setup the copy arguments
@@ -414,7 +427,7 @@ func (c *imageCmd) run(conf *config.Config, args []string) 
error {
                }
 
                // Do the copy
-               op, err := dest.CopyImage(d, *image, &args)
+               op, err := dest.CopyImage(d, *imgInfo, &args)
                if err != nil {
                        return err
                }
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to