[lxc-devel] [lxd/master] dir: use correct function

brauner on Github lxc-bot at linuxcontainers.org
Thu Sep 7 20:44:48 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170907/30f7932a/attachment.bin>
-------------- next part --------------
From adc6d744b5849c5e9c075e65c54c3aab41ed5c73 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 7 Sep 2017 22:43:49 +0200
Subject: [PATCH] dir: use correct function

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 lxd/storage_dir.go | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/lxd/storage_dir.go b/lxd/storage_dir.go
index 656fc02ba..681cbfb31 100644
--- a/lxd/storage_dir.go
+++ b/lxd/storage_dir.go
@@ -789,14 +789,16 @@ func (s *storageDir) ContainerSnapshotCreateEmpty(snapshotContainer container) e
 	// Check if the symlink
 	// ${LXD_DIR}/snapshots/<source_container_name> -> ${POOL_PATH}/snapshots/<source_container_name>
 	// exists and if not create it.
-	sourceContainerName, _, _ := containerGetParentAndSnapshotName(targetContainerName)
-	sourceContainerSymlink := shared.VarPath("snapshots", sourceContainerName)
-	sourceContainerSymlinkTarget := getSnapshotMountPoint(s.pool.Name, sourceContainerName)
-	if !shared.PathExists(sourceContainerSymlink) {
-		err := os.Symlink(sourceContainerSymlinkTarget, sourceContainerSymlink)
-		if err != nil {
-			return err
-		}
+	targetContainerMntPoint = getSnapshotMountPoint(s.pool.Name,
+		targetContainerName)
+	sourceName, _, _ := containerGetParentAndSnapshotName(targetContainerName)
+	snapshotMntPointSymlinkTarget := shared.VarPath("storage-pools",
+		s.pool.Name, "snapshots", sourceName)
+	snapshotMntPointSymlink := shared.VarPath("snapshots", sourceName)
+	err = createSnapshotMountpoint(targetContainerMntPoint,
+		snapshotMntPointSymlinkTarget, snapshotMntPointSymlink)
+	if err != nil {
+		return err
 	}
 
 	revert = false


More information about the lxc-devel mailing list