[lxc-devel] [lxd/master] Fix image refresh when fingerprint is passed
albertodonato on Github
lxc-bot at linuxcontainers.org
Tue Jul 18 13:31:15 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 313 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170718/fbfbfe8f/attachment.bin>
-------------- next part --------------
From 219a568d492b11bc77a58ce8745f46eaeb7a698c Mon Sep 17 00:00:00 2001
From: Alberto Donato <alberto.donato at canonical.com>
Date: Tue, 18 Jul 2017 15:30:45 +0200
Subject: [PATCH] Fix image refresh when fingerprint is passed.
Signed-off-by: Alberto Donato <alberto.donato at canonical.com>
---
lxd/images.go | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/lxd/images.go b/lxd/images.go
index 9b04cff4b..d764839ad 100644
--- a/lxd/images.go
+++ b/lxd/images.go
@@ -874,7 +874,7 @@ func autoUpdateImages(d *Daemon) {
for _, fingerprint := range images {
id, info, err := dbImageGet(d.db, fingerprint, false, true)
if err != nil {
- logger.Error("Error loading image", log.Ctx{"err": err, "fp": fingerprint})
+ logger.Error("Error loading image", log.Ctx{"err": err, "fp": info.Fingerprint})
continue
}
@@ -882,7 +882,7 @@ func autoUpdateImages(d *Daemon) {
continue
}
- autoUpdateImage(d, nil, fingerprint, id, info)
+ autoUpdateImage(d, nil, id, info)
}
logger.Infof("Done updating images")
@@ -890,7 +890,8 @@ func autoUpdateImages(d *Daemon) {
// Update a single image. The operation can be nil, if no progress tracking is needed.
// Returns whether the image has been updated.
-func autoUpdateImage(d *Daemon, op *operation, fingerprint string, id int, info *api.Image) error {
+func autoUpdateImage(d *Daemon, op *operation, id int, info *api.Image) error {
+ fingerprint := info.Fingerprint
_, source, err := dbImageSourceGet(d.db, id)
if err != nil {
logger.Error("Error getting source image", log.Ctx{"err": err, "fp": fingerprint})
@@ -1601,7 +1602,7 @@ func imageRefresh(d *Daemon, r *http.Request) Response {
// Begin background operation
run := func(op *operation) error {
- return autoUpdateImage(d, op, fingerprint, imageId, imageInfo)
+ return autoUpdateImage(d, op, imageId, imageInfo)
}
op, err := operationCreate(operationClassTask, nil, nil, run, nil, nil)
More information about the lxc-devel
mailing list