From bf6bf8ed8ff16c66fcd69cc7904a08df259b46e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 25 Nov 2013 06:31:38 +0100 Subject: [PATCH] backups: fix backup header extraction Pass only 'qubes.xml.000' to tar2qfile - this way it will stop reading the source after requested file(s). --- core/backup.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/backup.py b/core/backup.py index afd937c4..3bcf46a5 100644 --- a/core/backup.py +++ b/core/backup.py @@ -769,13 +769,11 @@ def restore_vm_dirs (backup_source, restore_tmpdir, passphrase, vms_dirs, vms, '-ix%sf' % ("v" if BACKUP_DEBUG else ""), backup_source, '-C', restore_tmpdir] + vms_dirs - # Remove already processed qubes.xml.000, because qfile-dom0-unpacker will - # refuse to override files tar1_env = os.environ.copy() # TODO: add some safety margin? tar1_env['UPDATES_MAX_BYTES'] = str(vms_size) # Restoring only header - if len(vms_dirs) == 2 and vms_dirs[0] == 'qubes.xml.000': + if vms_dirs and vms_dirs[0] == 'qubes.xml.000': tar1_env['UPDATES_MAX_FILES'] = '2' else: tar1_env['UPDATES_MAX_FILES'] = '0' @@ -886,10 +884,16 @@ def backup_restore_header(source, passphrase, if BACKUP_DEBUG: print "Working in", restore_tmpdir + # tar2qfile matches only beginnings, while tar full path + if appvm: + extract_filter = ['qubes.xml.000'] + else: + extract_filter = ['qubes.xml.000', 'qubes.xml.000.hmac'] + restore_vm_dirs (source, restore_tmpdir, passphrase=passphrase, - vms_dirs=['qubes.xml.000', 'qubes.xml.000.hmac'], + vms_dirs=extract_filter, vms=None, vms_size=40000, print_callback=print_callback,