backup: default tmpdir to /tmp, respect TMPDIR

This requires having at least 1GB free on /tmp, but it is fair
assumption - it's tmpfs in dom0 and while performing the backup most of
the VMs aren't running, so shouldn't be a problem. Anyway it is always
possible to set TMPDIR variable or pass --tmpdir cmdline option.
Using tmpfs based temporary directory should speedup the backup.

QubesOS/qubes-issues#1652
This commit is contained in:
Marek Marczykowski-Górecki 2016-05-05 00:00:25 +02:00
parent a8ea1d4b39
commit 7e76342919
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -450,7 +450,7 @@ def backup_do(base_backup_dir, files_to_backup, passphrase,
progress_callback=None, encrypted=False, appvm=None,
compressed=False, hmac_algorithm=DEFAULT_HMAC_ALGORITHM,
crypto_algorithm=DEFAULT_CRYPTO_ALGORITHM,
tmpdir="/var/tmp"):
tmpdir=None):
global running_backup_operation
def queue_put_with_check(proc, vmproc, queue, element):
@ -511,7 +511,7 @@ def backup_do(base_backup_dir, files_to_backup, passphrase,
progress = blocks_backedup * 11 / total_backup_sz
progress_callback(progress)
backup_tmpdir = tempfile.mkdtemp(prefix="{}/backup_".format(tmpdir))
backup_tmpdir = tempfile.mkdtemp(prefix="backup_", dir=tmpdir)
running_backup_operation.tmpdir_to_remove = backup_tmpdir
# Tar with tape length does not deals well with stdout (close stdout between