[lxc-devel] [lxd/master] storage: handle btrfs migration on different lxds

brauner on Github lxc-bot at linuxcontainers.org
Tue May 16 13:28:37 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 519 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170516/b321ae69/attachment.bin>
-------------- next part --------------
From af09d582c96961feef6013d680ac5eff62f619ac Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Tue, 16 May 2017 15:26:10 +0200
Subject: [PATCH] storage: handle btrfs migration on different lxds

If we receive btrfs subvolumes from an older LXD instance they are not called
".migration-send" but rather ".root". Handle this case.

Closes #3323.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 lxd/storage_btrfs.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lxd/storage_btrfs.go b/lxd/storage_btrfs.go
index 3c9bdd6..a295697 100644
--- a/lxd/storage_btrfs.go
+++ b/lxd/storage_btrfs.go
@@ -1971,6 +1971,10 @@ func (s *storageBtrfs) MigrationSink(live bool, container container, snapshots [
 		}
 
 		receivedSnapshot := fmt.Sprintf("%s/.migration-send", btrfsPath)
+		// handle older lxd versions
+		if !shared.PathExists(receivedSnapshot) {
+			receivedSnapshot = fmt.Sprintf("%s/.root", btrfsPath)
+		}
 		if isSnapshot {
 			receivedSnapshot = fmt.Sprintf("%s/%s", btrfsPath, snapName)
 			err = s.btrfsPoolVolumesSnapshot(receivedSnapshot, targetPath, true)


More information about the lxc-devel mailing list