The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/3621
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 1d06f56e27cf4b2ae1b46837d85ff65f0b2a28d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <[email protected]> Date: Tue, 1 Aug 2017 17:48:12 -0400 Subject: [PATCH] Make "lxc image copy" fast again 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 | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/lxc/image.go b/lxc/image.go index 2dcbe3a22..9afe70aea 100644 --- a/lxc/image.go +++ b/lxc/image.go @@ -388,14 +388,25 @@ func (c *imageCmd) run(conf *config.Config, args []string) error { return err } - image := c.dereferenceAlias(d, inName) - imgInfo, _, err := d.GetImage(image) - if err != nil { - return err + var imgInfo *api.Image + if conf.Remotes[remote].Protocol == "simplestreams" && !c.copyAliases { + // All simplestreams images are always public, so unless we + // need the aliases list too, we can skip the otherwise very expensive + // alias resolution and image info retrieval step. + imgInfo = &api.Image{} + imgInfo.Fingerprint = inName + imgInfo.Public = true + } else { + // Resolve any alias and then grab the image information from the source + image := c.dereferenceAlias(d, inName) + imgInfo, _, err = d.GetImage(image) + if err != nil { + return err + } } - if imgInfo.Public && imgInfo.Fingerprint != inName && !strings.HasPrefix(imgInfo.Fingerprint, image) { - // If dealing with an alias, set the imgInfo fingerprint to match + if imgInfo.Public && imgInfo.Fingerprint != inName && !strings.HasPrefix(imgInfo.Fingerprint, inName) { + // If dealing with an alias, set the imgInfo fingerprint to match the provided alias (needed for auto-update) imgInfo.Fingerprint = inName }
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
