[prev in list] [next in list] [prev in thread] [next in thread]
List: lxc-devel
Subject: [lxc-devel] [lxd/master] btrfs: workaround btrfs bug
From: brauner on Github <lxc-bot () linuxcontainers ! org>
Date: 2017-09-25 15:51:19
Message-ID: 20170925155119.D84814DD6C () mailman01 ! srv ! dcmtl ! stgraber ! net
[Download RAW message or body]
[Attachment #2 (text/x-mailbox)]
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/3846
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) ===
It seems that btrfs v4.12.1 allows:
(1) btrfs send -p <ro-snap-1> <ro-snap-0>
but disallows
(2) btrfs send <ro-snap-0> -p <ro-snap-1>
Code-wise it assumes that <ro-snap-1> is always found at optind == 1. I
reported upstream and might patch this once they told me which direction they
want to go with this. Until then, work around it.
Closes #3843.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
[Attachment #3 (text/plain)]
From 41bb04eb3c847ef2ef099a8aaf91a47acabfc13b Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner@ubuntu.com>
Date: Mon, 25 Sep 2017 17:48:13 +0200
Subject: [PATCH 1/2] btrfs: remove dependency on symlink
Only use the proper mountpoints on the storage pools.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
---
lxd/storage_btrfs.go | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/lxd/storage_btrfs.go b/lxd/storage_btrfs.go
index 2d791360d..9d8a32589 100644
--- a/lxd/storage_btrfs.go
+++ b/lxd/storage_btrfs.go
@@ -1832,8 +1832,6 @@ func (s *btrfsMigrationSourceDriver) SendWhileRunning(conn \
*websocket.Conn, op *
migrationSendSnapshot := fmt.Sprintf("%s/.migration-send", tmpContainerMntPoint)
snapshotMntPoint := getSnapshotMountPoint(containerPool, containerName)
- if s.container.IsSnapshot() {
- }
err = s.btrfs.btrfsPoolVolumesSnapshot(snapshotMntPoint, migrationSendSnapshot, \
true) if err != nil {
return err
@@ -1888,14 +1886,17 @@ func (s *btrfsMigrationSourceDriver) SendWhileRunning(conn \
*websocket.Conn, op * }
func (s *btrfsMigrationSourceDriver) SendAfterCheckpoint(conn *websocket.Conn, \
bwlimit string) error {
- tmpPath := containerPath(fmt.Sprintf("%s/.migration-send", s.container.Name()), \
true) + tmpPath := getSnapshotMountPoint(s.btrfs.pool.Name,
+ fmt.Sprintf("%s/.migration-send", s.container.Name()))
err := os.MkdirAll(tmpPath, 0700)
if err != nil {
return err
}
s.stoppedSnapName = fmt.Sprintf("%s/.root", tmpPath)
- err = s.btrfs.btrfsPoolVolumesSnapshot(s.container.Path(), s.stoppedSnapName, true)
+ parentName, _, _ := containerGetParentAndSnapshotName(s.container.Name())
+ containerMntPt := getContainerMountPoint(s.btrfs.pool.Name, parentName)
+ err = s.btrfs.btrfsPoolVolumesSnapshot(containerMntPt, s.stoppedSnapName, true)
if err != nil {
return err
}
@@ -1956,7 +1957,7 @@ func (s *storageBtrfs) MigrationSource(c container, \
containerOnly bool) (Migrati
if !containerOnly {
for _, snap := range snapshots {
- btrfsPath := snap.Path()
+ btrfsPath := getSnapshotMountPoint(s.pool.Name, snap.Name())
driver.btrfsSnapshotNames = append(driver.btrfsSnapshotNames, btrfsPath)
}
}
From 85fdec4de93db6ceede914dc1c9b6aff09b4254c Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner@ubuntu.com>
Date: Mon, 25 Sep 2017 17:48:44 +0200
Subject: [PATCH 2/2] btrfs: workaround btrfs bug
It seems that btrfs v4.12.1 allows:
(1) btrfs send -p <ro-snap-1> <ro-snap-0>
but disallows
(2) btrfs send <ro-snap-0> -p <ro-snap-1>
Code-wise it assumes that <ro-snap-1> is always found at optind == 1. I
reported upstream and might patch this once they told me which direction they
want to go with this. Until then, work around it.
Closes #3843.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
---
lxd/storage_btrfs.go | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lxd/storage_btrfs.go b/lxd/storage_btrfs.go
index 9d8a32589..06d0c924b 100644
--- a/lxd/storage_btrfs.go
+++ b/lxd/storage_btrfs.go
@@ -1766,10 +1766,11 @@ func (s *btrfsMigrationSourceDriver) Snapshots() []container \
{ }
func (s *btrfsMigrationSourceDriver) send(conn *websocket.Conn, btrfsPath string, \
btrfsParent string, readWrapper func(io.ReadCloser) io.ReadCloser) \
error {
- args := []string{"send", btrfsPath}
+ args := []string{"send"}
if btrfsParent != "" {
args = append(args, "-p", btrfsParent)
}
+ args = append(args, btrfsPath)
cmd := exec.Command("btrfs", args...)
[Attachment #4 (text/plain)]
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic