[lxc-devel] [lxd/master] migration: fix tempdir handling

tych0 on Github lxc-bot at linuxcontainers.org
Thu Jul 7 15:00:21 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 500 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160707/a0e3c1a1/attachment.bin>
-------------- next part --------------
From 1b37603248f27b852464d6cec059b5aba9ad5459 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Thu, 7 Jul 2016 14:59:25 +0000
Subject: [PATCH] migration: fix tempdir handling

If we fail to create the tempdir, we don't need to delete it. We *do*
however, need to inform the main thread that the restore failed.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 lxd/migrate.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/migrate.go b/lxd/migrate.go
index 3ea1a76..14e9c00 100644
--- a/lxd/migrate.go
+++ b/lxd/migrate.go
@@ -540,7 +540,7 @@ func (c *migrationSink) do() error {
 			var err error
 			imagesDir, err = ioutil.TempDir("", "lxd_restore_")
 			if err != nil {
-				os.RemoveAll(imagesDir)
+				restore <- err
 				return
 			}
 


More information about the lxc-devel mailing list