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

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) ===

From b15100d983766081850ff67763d276f93d0bb12b Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@canonical.com>
Date: Wed, 19 Feb 2020 16:07:27 +0000
Subject: [PATCH 1/2] lxd/images: Removes hardcoded default project arg for
 ImageGet in autoUpdateImage

When using images in projects, this was preventing updates of image and leaving 
orphaned volumes created on storage device.

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
---
 lxd/images.go | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lxd/images.go b/lxd/images.go
index a9f3a2309d..1fd2b6bea8 100644
--- a/lxd/images.go
+++ b/lxd/images.go
@@ -1126,7 +1126,6 @@ func autoUpdateImage(d *Daemon, op *operations.Operation, 
id int, info *api.Imag
 
        for _, poolName := range poolNames {
                newInfo, err := d.ImageDownload(op, source.Server, 
source.Protocol, source.Certificate, "", source.Alias, info.Type, false, true, 
poolName, false, project)
-
                if err != nil {
                        logger.Error("Failed to update the image", 
log.Ctx{"err": err, "fp": fingerprint})
                        continue
@@ -1138,7 +1137,7 @@ func autoUpdateImage(d *Daemon, op *operations.Operation, 
id int, info *api.Imag
                        continue
                }
 
-               newId, _, err := d.cluster.ImageGet("default", hash, false, 
true)
+               newID, _, err := d.cluster.ImageGet(project, hash, false, true)
                if err != nil {
                        logger.Error("Error loading image", log.Ctx{"err": err, 
"fp": hash})
                        continue

From 07de45c970fe2f4cb4c7dbde61b80344d995fa56 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@canonical.com>
Date: Wed, 19 Feb 2020 16:08:25 +0000
Subject: [PATCH 2/2] lxd/images: Golint and comments

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
---
 lxd/images.go | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lxd/images.go b/lxd/images.go
index 1fd2b6bea8..81b96dc2a4 100644
--- a/lxd/images.go
+++ b/lxd/images.go
@@ -1157,19 +1157,18 @@ func autoUpdateImage(d *Daemon, op 
*operations.Operation, id int, info *api.Imag
                        continue
                }
 
-               err = d.cluster.ImageAliasesMove(id, newId)
+               err = d.cluster.ImageAliasesMove(id, newID)
                if err != nil {
                        logger.Error("Error moving aliases", log.Ctx{"err": 
err, "fp": hash})
                        continue
                }
 
-               err = d.cluster.ImageCopyDefaultProfiles(id, newId)
+               err = d.cluster.ImageCopyDefaultProfiles(id, newID)
                if err != nil {
                        logger.Error("Copying default profiles", log.Ctx{"err": 
err, "fp": hash})
                }
 
-               // If we do have optimized pools, make sure we remove
-               // the volumes associated with the image.
+               // If we do have optimized pools, make sure we remove the 
volumes associated with the image.
                if poolName != "" {
                        err = doDeleteImageFromPool(d.State(), fingerprint, 
poolName)
                        if err != nil {
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to