backups: fix handling new format without backup header
Tar will report error when 'backup-header' file wasn't found. Ignore this particular error.
This commit is contained in:
parent
49259dacf6
commit
a6740610e3
@ -963,6 +963,8 @@ def restore_vm_dirs (backup_source, restore_tmpdir, passphrase, vms_dirs, vms,
|
|||||||
else:
|
else:
|
||||||
filelist_pipe = command.stdout
|
filelist_pipe = command.stdout
|
||||||
|
|
||||||
|
expect_tar_error = False
|
||||||
|
|
||||||
to_extract = Queue()
|
to_extract = Queue()
|
||||||
|
|
||||||
# If want to analyze backup header, do it now
|
# If want to analyze backup header, do it now
|
||||||
@ -1014,6 +1016,12 @@ def restore_vm_dirs (backup_source, restore_tmpdir, passphrase, vms_dirs, vms,
|
|||||||
else:
|
else:
|
||||||
# If this isn't backup header, pass it to ExtractWorker
|
# If this isn't backup header, pass it to ExtractWorker
|
||||||
to_extract.put(filename)
|
to_extract.put(filename)
|
||||||
|
# when tar do not find expected file in archive, it exit with
|
||||||
|
# code 2. This will happen because we've requested backup-header
|
||||||
|
# file, but the archive do not contain it. Ignore this particular
|
||||||
|
# error.
|
||||||
|
if not appvm:
|
||||||
|
expect_tar_error = True
|
||||||
|
|
||||||
# Setup worker to extract encrypted data chunks to the restore dirs
|
# Setup worker to extract encrypted data chunks to the restore dirs
|
||||||
# Create the process here to pass it options extracted from backup header
|
# Create the process here to pass it options extracted from backup header
|
||||||
@ -1060,7 +1068,7 @@ def restore_vm_dirs (backup_source, restore_tmpdir, passphrase, vms_dirs, vms,
|
|||||||
passphrase, hmac_algorithm):
|
passphrase, hmac_algorithm):
|
||||||
to_extract.put(os.path.join(restore_tmpdir, filename))
|
to_extract.put(os.path.join(restore_tmpdir, filename))
|
||||||
|
|
||||||
if command.wait() != 0:
|
if command.wait() != 0 and not expect_tar_error:
|
||||||
raise QubesException(
|
raise QubesException(
|
||||||
"ERROR: unable to read the qubes backup file {0} ({1}). " \
|
"ERROR: unable to read the qubes backup file {0} ({1}). " \
|
||||||
"Is it really a backup?".format(backup_source, command.wait()))
|
"Is it really a backup?".format(backup_source, command.wait()))
|
||||||
|
Loading…
Reference in New Issue
Block a user