[lxc-devel] [lxd/master] Storage: Skip missing files during export

tomponline on Github lxc-bot at linuxcontainers.org
Tue Apr 28 14:58:41 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 376 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200428/d7566327/attachment.bin>
-------------- next part --------------
From 57d0262d0e95c9ba435b9fa9b5d7ed0b152ddf0b Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 28 Apr 2020 15:57:44 +0100
Subject: [PATCH] lxd/storage/drivers/generic/vfs: Skip missing files during
 export

Fixes #7242

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

diff --git a/lxd/storage/drivers/generic_vfs.go b/lxd/storage/drivers/generic_vfs.go
index 7303e9e770..966cbb374d 100644
--- a/lxd/storage/drivers/generic_vfs.go
+++ b/lxd/storage/drivers/generic_vfs.go
@@ -22,6 +22,7 @@ import (
 	"github.com/lxc/lxd/shared/instancewriter"
 	"github.com/lxc/lxd/shared/ioprogress"
 	log "github.com/lxc/lxd/shared/log15"
+	"github.com/lxc/lxd/shared/logger"
 )
 
 // genericVFSGetResources is a generic GetResources implementation for VFS-only drivers.
@@ -521,7 +522,12 @@ func genericVFSBackupVolume(d Driver, vol Volume, tarWriter *instancewriter.Inst
 				d.Logger().Debug("Copying container filesystem volume", log.Ctx{"sourcePath": mountPath, "prefix": prefix})
 				return filepath.Walk(mountPath, func(srcPath string, fi os.FileInfo, err error) error {
 					if err != nil {
-						return err
+						if os.IsNotExist(err) {
+							logger.Warnf("File vanished during export: %q, skipping", srcPath)
+							return nil
+						}
+
+						return errors.Wrapf(err, "Error walking file during export: %q", srcPath)
 					}
 
 					name := filepath.Join(prefix, strings.TrimPrefix(srcPath, mountPath))


More information about the lxc-devel mailing list