[lxc-devel] [lxd/master] zfs fixes
stgraber on Github
lxc-bot at linuxcontainers.org
Fri Apr 8 21:17:04 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160408/5163e4f8/attachment.bin>
-------------- next part --------------
From 90f786bd1b2a54fdc97b0bec9a915ce4c0fb0a00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 8 Apr 2016 16:24:05 -0400
Subject: [PATCH 1/2] zfs: Clean any leftover snapshot
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This specifically fixes a case where copying a snapshot into a new
container on a remote host causes a snapshot to stick around on the
target, then causing further container copies or moves to fail.
Closes #1827
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/storage_zfs.go | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lxd/storage_zfs.go b/lxd/storage_zfs.go
index 2436b08..aa65fa2 100644
--- a/lxd/storage_zfs.go
+++ b/lxd/storage_zfs.go
@@ -1349,14 +1349,15 @@ func (s *storageZfs) MigrationSink(live bool, container container, snapshots []c
defer func() {
/* clean up our migration-send snapshots that we got from recv. */
- snapshots, err := s.zfsListSnapshots(fmt.Sprintf("containers/%s", container.Name()))
+ zfsSnapshots, err := s.zfsListSnapshots(fmt.Sprintf("containers/%s", container.Name()))
if err != nil {
shared.Log.Error("failed listing snapshots post migration", "err", err)
return
}
- for _, snap := range snapshots {
- if !strings.HasPrefix(snap, "migration-send") {
+ for _, snap := range zfsSnapshots {
+ // If we received a bunch of snapshots, remove the migration-send-* ones, if not, wipe any snapshot we got
+ if snapshots != nil && len(snapshots) > 0 && !strings.HasPrefix(snap, "migration-send") {
continue
}
From d83dbdf6aab7d3d4ce0ee6d41c0a1346163307f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 8 Apr 2016 16:37:52 -0400
Subject: [PATCH 2/2] zfs: Ignore non-LXD paths in user count
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/storage_zfs.go | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lxd/storage_zfs.go b/lxd/storage_zfs.go
index aa65fa2..d0bb903 100644
--- a/lxd/storage_zfs.go
+++ b/lxd/storage_zfs.go
@@ -1066,6 +1066,14 @@ func (s *storageZfs) zfsGetPoolUsers() ([]string, error) {
users := []string{}
for _, subvol := range subvols {
+ path := strings.Split(subvol, "/")
+
+ // Only care about plausible LXD paths
+ if !shared.StringInSlice(path[0], exceptions) {
+ continue
+ }
+
+ // Ignore empty paths
if shared.StringInSlice(subvol, exceptions) {
continue
}
More information about the lxc-devel
mailing list