[lxc-devel] [lxd/master] Storage: Detect cached image filesystem changes for VM images too

tomponline on Github lxc-bot at linuxcontainers.org
Fri May 1 14:31:28 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 438 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200501/d0d29396/attachment.bin>
-------------- next part --------------
From a829d0555c804a6228fce2940e96c26e5aefaaea Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Fri, 1 May 2020 15:30:34 +0100
Subject: [PATCH] lxd/storage/backend/lxd: Detect cached image filesystem
 changes for VM images too

They have a filesystem config volume too, so need to also use this check.

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/storage/backend_lxd.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lxd/storage/backend_lxd.go b/lxd/storage/backend_lxd.go
index ff06e96986..3cc6307e46 100644
--- a/lxd/storage/backend_lxd.go
+++ b/lxd/storage/backend_lxd.go
@@ -2041,7 +2041,8 @@ func (b *lxdBackend) EnsureImage(fingerprint string, op *operations.Operation) e
 
 	// If an existing DB row was found, check if filesystem is the same as the current pool's filesystem.
 	// If not we need to delete the existing cached image volume and re-create using new filesystem.
-	if imgDBVol != nil && contentType == drivers.ContentTypeFS {
+	// We need to do this for VM block images too, as they create a filesystem based config volume too.
+	if imgDBVol != nil {
 		if b.Driver().Info().BlockBacking && imgDBVol.Config["block.filesystem"] != b.poolBlockFilesystem() {
 			logger.Debug("Filesystem of pool has changed since cached image volume created, regenerating image volume")
 			err = b.DeleteImage(fingerprint, op)


More information about the lxc-devel mailing list