[lxc-devel] [lxd/master] lxd/backups: Use backups dir for unpack

stgraber on Github lxc-bot at linuxcontainers.org
Mon Jun 22 20:16:42 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200622/6842c073/attachment.bin>
-------------- next part --------------
From ea77ad2ca9999841e62b71c4e97223817755647d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 22 Jun 2020 16:15:03 -0400
Subject: [PATCH] lxd/backups: Use backups dir for unpack
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #7561

Signed-off-by: St├ęphane Graber <stgraber at ubuntu.com>
---
 lxd/instances_post.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lxd/instances_post.go b/lxd/instances_post.go
index 2e45b7d63d..f761c3e182 100644
--- a/lxd/instances_post.go
+++ b/lxd/instances_post.go
@@ -541,7 +541,7 @@ func createFromBackup(d *Daemon, project string, data io.Reader, pool string) re
 	defer revert.Fail()
 
 	// Create temporary file to store uploaded backup data.
-	backupFile, err := ioutil.TempFile("", "lxd_backup_")
+	backupFile, err := ioutil.TempFile(shared.VarPath("backups"), "lxd_backup_")
 	if err != nil {
 		return response.InternalError(err)
 	}
@@ -566,7 +566,7 @@ func createFromBackup(d *Daemon, project string, data io.Reader, pool string) re
 		decomArgs := append(decomArgs, backupFile.Name())
 
 		// Create temporary file to store the decompressed tarball in.
-		tarFile, err := ioutil.TempFile("", "lxd_decompress_")
+		tarFile, err := ioutil.TempFile(shared.VarPath("backups"), "lxd_backup_decompress_")
 		if err != nil {
 			return response.InternalError(err)
 		}


More information about the lxc-devel mailing list