diff --git a/core/backup.py b/core/backup.py index fc0c5e96..976925f1 100644 --- a/core/backup.py +++ b/core/backup.py @@ -742,7 +742,13 @@ def wait_backup_feedback(progress_callback, in_stream, streamproc, if len(buffer) <= 0: return "" - backup_target.write(buffer) + try: + backup_target.write(buffer) + except IOError as e: + if e.errno == errno.EPIPE: + run_error = "target" + else: + raise if hmac: hmac.stdin.write(buffer) @@ -1145,6 +1151,15 @@ def restore_vm_dirs (backup_source, restore_tmpdir, passphrase, vms_dirs, vms, while True: if running_backup_operation and running_backup_operation.canceled: break + if not extract_proc.is_alive(): + command.terminate() + command.wait() + expect_tar_error = True + if vmproc: + vmproc.terminate() + vmproc.wait() + vmproc = None + break if nextfile is not None: filename = nextfile else: diff --git a/qvm-tools/qvm-backup-restore b/qvm-tools/qvm-backup-restore index 17d20a82..76578dda 100755 --- a/qvm-tools/qvm-backup-restore +++ b/qvm-tools/qvm-backup-restore @@ -227,8 +227,11 @@ def main(): exit (0) - backup_restore_do(restore_info, - host_collection=host_collection) + try: + backup_restore_do(restore_info, + host_collection=host_collection) + except QubesException as e: + print >> sys.stderr, "ERROR: %s" % str(e) host_collection.unlock_db()