backup: update last backup timestamp only when backup succeed
QubesOS/qubes-issues#2931
This commit is contained in:
parent
1556814f59
commit
bde8d45cca
@ -652,9 +652,6 @@ class Backup(object):
|
|||||||
self._done_vms_bytes += vm_info.size
|
self._done_vms_bytes += vm_info.size
|
||||||
self._current_vm_bytes = 0
|
self._current_vm_bytes = 0
|
||||||
self._send_progress_update()
|
self._send_progress_update()
|
||||||
# Save date of last backup
|
|
||||||
if vm_info.vm:
|
|
||||||
vm_info.vm.backup_timestamp = datetime.datetime.now()
|
|
||||||
|
|
||||||
yield from output_queue.put(QUEUE_FINISHED)
|
yield from output_queue.put(QUEUE_FINISHED)
|
||||||
|
|
||||||
@ -799,10 +796,17 @@ class Backup(object):
|
|||||||
os.close(backup_stdout)
|
os.close(backup_stdout)
|
||||||
else:
|
else:
|
||||||
backup_stdout.close()
|
backup_stdout.close()
|
||||||
|
try:
|
||||||
if vmproc_task:
|
if vmproc_task:
|
||||||
yield from vmproc_task
|
yield from vmproc_task
|
||||||
|
finally:
|
||||||
shutil.rmtree(self.tmpdir)
|
shutil.rmtree(self.tmpdir)
|
||||||
|
|
||||||
|
# Save date of last backup, only when backup succeeded
|
||||||
|
for qid, vm_info in files_to_backup.items():
|
||||||
|
if vm_info.vm:
|
||||||
|
vm_info.vm.backup_timestamp = datetime.datetime.now()
|
||||||
|
|
||||||
self.app.save()
|
self.app.save()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user