The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/8017
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) === This uses a bit of a shortcut by checking the filesystem for it instead of hitting the database. Closes #8015 Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From e035cf76c534740d806556dbb7df0b6532a14274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Fri, 9 Oct 2020 16:51:10 -0400 Subject: [PATCH] lxd/storage: Check base image is available locally MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This uses a bit of a shortcut by checking the filesystem for it instead of hitting the database. Closes #8015 Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/storage/backend_lxd.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lxd/storage/backend_lxd.go b/lxd/storage/backend_lxd.go index 379c644874..20ddfc145c 100644 --- a/lxd/storage/backend_lxd.go +++ b/lxd/storage/backend_lxd.go @@ -1125,12 +1125,17 @@ func (b *lxdBackend) CreateInstanceFromMigration(inst instance.Instance, conn io // transfer the base image files too. if args.MigrationType.FSType == migration.MigrationFSType_RSYNC { fingerprint := inst.ExpandedConfig()["volatile.base_image"] + + // Confirm that the image is present in the project. _, _, err = b.state.Cluster.GetImage(inst.Project(), fingerprint, false) if err != db.ErrNoSuchObject && err != nil { return err } - if err == nil { + // Then make sure that the image is available locally too (not guaranteed in clusters). + local := shared.PathExists(shared.VarPath("images", fingerprint)) + + if err == nil && local { logger.Debug("Using optimised migration from existing image", log.Ctx{"fingerprint": fingerprint}) // Populate the volume filler with the fingerprint and image filler
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel