[lxc-devel] [lxd/master] lxd/storage/lvm: Pass nouuid for xfs backups

stgraber on Github lxc-bot at linuxcontainers.org
Thu Mar 14 22:43:27 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/20190314/a4900ed3/attachment.bin>
-------------- next part --------------
From 81132f8bc2cccfc612c4c93ef5e5cdc6a20f85a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 14 Mar 2019 18:34:14 -0400
Subject: [PATCH] lxd/storage/lvm: Pass nouuid for xfs backups
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #5566

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

diff --git a/lxd/storage_lvm.go b/lxd/storage_lvm.go
index a1d529c04b..33f631db7d 100644
--- a/lxd/storage_lvm.go
+++ b/lxd/storage_lvm.go
@@ -1251,10 +1251,10 @@ func (s *storageLvm) ContainerRefresh(target container, source container, snapsh
 }
 
 func (s *storageLvm) ContainerMount(c container) (bool, error) {
-	return s.doContainerMount(c.Project(), c.Name())
+	return s.doContainerMount(c.Project(), c.Name(), false)
 }
 
-func (s *storageLvm) doContainerMount(project, name string) (bool, error) {
+func (s *storageLvm) doContainerMount(project, name string, snap bool) (bool, error) {
 	logger.Debugf("Mounting LVM storage volume for container \"%s\" on storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
 	containerLvmName := containerNameToLVName(name)
@@ -1285,6 +1285,13 @@ func (s *storageLvm) doContainerMount(project, name string) (bool, error) {
 	ourMount := false
 	if !shared.IsMountPoint(containerMntPoint) {
 		mountFlags, mountOptions := lxdResolveMountoptions(s.getLvmMountOptions())
+		if snap && lvFsType == "xfs" {
+			idx := strings.Index(mountOptions, "nouuid")
+			if idx < 0 {
+				mountOptions += ",nouuid"
+			}
+		}
+
 		mounterr = tryMount(containerLvmPath, containerMntPoint, lvFsType, mountFlags, mountOptions)
 		ourMount = true
 	}
@@ -1760,7 +1767,7 @@ func (s *storageLvm) ContainerBackupCreate(backup backup, source container) erro
 		containerNameToLVName(sourceLvmDatasetSnapshot))
 
 	// Mount the temporary snapshot
-	_, err = s.doContainerMount(source.Project(), sourceLvmDatasetSnapshot)
+	_, err = s.doContainerMount(source.Project(), sourceLvmDatasetSnapshot, true)
 	if err != nil {
 		return err
 	}
@@ -1898,7 +1905,7 @@ func (s *storageLvm) doContainerBackupLoad(project, containerName string, privil
 		return "", err
 	}
 
-	_, err = s.doContainerMount(project, containerName)
+	_, err = s.doContainerMount(project, containerName, false)
 	if err != nil {
 		return "", err
 	}


More information about the lxc-devel mailing list