[lxc-devel] [lxd/master] lxd/images: Fix crash on refresh error

stgraber on Github lxc-bot at linuxcontainers.org
Wed Jul 31 14:42:49 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190731/57af9617/attachment.bin>
-------------- next part --------------
From 357addb9489c69abfa38d466a499d1acee0ee326 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 31 Jul 2019 10:42:18 -0400
Subject: [PATCH] lxd/images: Fix crash on refresh error
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #6027

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/images.go | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lxd/images.go b/lxd/images.go
index e34b85f83c..efb35eee83 100644
--- a/lxd/images.go
+++ b/lxd/images.go
@@ -1209,12 +1209,14 @@ func pruneLeftoverImages(d *Daemon) {
 	op, err := operationCreate(d.cluster, "", operationClassTask, db.OperationImagesPruneLeftover, nil, nil, opRun, nil, nil)
 	if err != nil {
 		logger.Error("Failed to start image leftover cleanup operation", log.Ctx{"err": err})
+		return
 	}
 
 	logger.Infof("Pruning leftover image files")
 	_, err = op.Run()
 	if err != nil {
 		logger.Error("Failed to prune leftover image files", log.Ctx{"err": err})
+		return
 	}
 	logger.Infof("Done pruning leftover image files")
 }


More information about the lxc-devel mailing list