backup: improved error handling during restore process
This commit is contained in:
parent
04d38055a6
commit
3e4637415a
@ -1522,7 +1522,7 @@ def backup_restore_header(restore_target, passphrase, encrypt=False, appvm=None)
|
|||||||
qvm_collection.unlock_db()
|
qvm_collection.unlock_db()
|
||||||
|
|
||||||
# If APPVM, STDOUT is a PIPE
|
# If APPVM, STDOUT is a PIPE
|
||||||
vmproc = vm.run(command = restore_command, passio_popen = True)
|
vmproc = vm.run(command = restore_command, passio_popen = True, passio_stderr = True)
|
||||||
vmproc.stdin.write(restore_target.replace("\r","").replace("\n","")+"\n")
|
vmproc.stdin.write(restore_target.replace("\r","").replace("\n","")+"\n")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -1544,9 +1544,19 @@ def backup_restore_header(restore_target, passphrase, encrypt=False, appvm=None)
|
|||||||
|
|
||||||
while not os.path.exists(os.path.join(backup_tmpdir,hmacfile)):
|
while not os.path.exists(os.path.join(backup_tmpdir,hmacfile)):
|
||||||
time.sleep(1000)
|
time.sleep(1000)
|
||||||
|
|
||||||
command.terminate()
|
command.terminate()
|
||||||
command.wait()
|
command.wait()
|
||||||
|
|
||||||
|
if vmproc.poll() != None and vmproc.poll() != 0:
|
||||||
|
error = vmproc.stderr.read()
|
||||||
|
print error,vmproc.poll(),command.poll()
|
||||||
|
raise QubesException("ERROR: retrieving backup headers:{0}".format(error))
|
||||||
|
elif command.poll() != None and command.poll() not in [0,-15]:
|
||||||
|
error = command.stderr.read()
|
||||||
|
print error,vmproc.poll(),command.poll()
|
||||||
|
raise QubesException("ERROR: retrieving backup headers:{0}".format(error))
|
||||||
|
|
||||||
vmproc.terminate()
|
vmproc.terminate()
|
||||||
vmproc.wait()
|
vmproc.wait()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user