[lxc-devel] [lxd/stable-2.0] storage btrfs: cleanup empty migration dirs
brauner on Github
lxc-bot at linuxcontainers.org
Wed May 10 17:10:54 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/20170510/f1a1b796/attachment.bin>
-------------- next part --------------
From 2ba9de34cbf3c591bc5bea70f429be5038bd7eb8 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 10 May 2017 19:09:55 +0200
Subject: [PATCH] storage btrfs: cleanup empty migration dirs
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 5b3bf21..1c915e0 100644
--- a/lxd/storage_btrfs.go
+++ b/lxd/storage_btrfs.go
@@ -806,6 +806,7 @@ func (s *btrfsMigrationSourceDriver) SendWhileRunning(conn *websocket.Conn) erro
if err != nil {
return err
}
+ defer os.RemoveAll(tmpPath)
btrfsPath := fmt.Sprintf("%s/.root", tmpPath)
if err := s.btrfs.subvolsSnapshot(s.container.Path(), btrfsPath, true); err != nil {
@@ -836,11 +837,13 @@ func (s *btrfsMigrationSourceDriver) SendWhileRunning(conn *websocket.Conn) erro
if err != nil {
return err
}
+ defer os.RemoveAll(tmpPath)
s.runningSnapName = fmt.Sprintf("%s/.root", tmpPath)
if err := s.btrfs.subvolsSnapshot(s.container.Path(), s.runningSnapName, true); err != nil {
return err
}
+ defer s.btrfs.subvolsDelete(s.runningSnapName)
btrfsParent := ""
if len(s.btrfsSnapshotNames) > 0 {
@@ -856,6 +859,7 @@ func (s *btrfsMigrationSourceDriver) SendAfterCheckpoint(conn *websocket.Conn) e
if err != nil {
return err
}
+ defer os.RemoveAll(tmpPath)
s.stoppedSnapName = fmt.Sprintf("%s/.root", tmpPath)
err = s.btrfs.subvolsSnapshot(s.container.Path(), s.stoppedSnapName, true)
More information about the lxc-devel
mailing list