From 6338b936e27359a06ba310114a65106fbb838a7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 8 Sep 2019 05:11:53 +0200 Subject: [PATCH] backup/restore: use qfile-unpacker in a VM, request disk space monitoring Make it possible to use qvm-backup-restore in a VM. This commit is about accessing backup itself, when stored in another VM. This involve using qfile-unpacker instead of qfile-dom0-unpacker and also requesting disk space monitoring, as a VM probably won't have enough space to hold the whole backup at once. QubesOS/qubes-issues#4791 QubesOS/qubes-issues#5310 --- qubesadmin/backup/restore.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/qubesadmin/backup/restore.py b/qubesadmin/backup/restore.py index fea3b08..0ff47f9 100644 --- a/qubesadmin/backup/restore.py +++ b/qubesadmin/backup/restore.py @@ -992,9 +992,14 @@ class BackupRestore(object): self.processes_to_kill_on_cancel.append(vmproc) backup_stdin = vmproc.stdout - # FIXME use /usr/lib/qubes/qfile-unpacker in non-dom0 - tar1_command = ['/usr/libexec/qubes/qfile-dom0-unpacker', - str(os.getuid()), self.tmpdir, '-v'] + if isinstance(self.app, qubesadmin.app.QubesRemote): + qfile_unpacker_path = '/usr/lib/qubes/qfile-unpacker' + else: + qfile_unpacker_path = '/usr/libexec/qubes/qfile-dom0-unpacker' + # keep at least 500M free for decryption of a previous chunk + tar1_command = [qfile_unpacker_path, + str(os.getuid()), self.tmpdir, '-v', + '-w', str(500 * 1024 * 1024)] else: backup_stdin = open(self.backup_location, 'rb')