fix(backups): robustness against stale locks: snapshot sizing

backups-forget
Houkime 2023-08-09 14:46:27 +00:00
parent 26ab7b4d7b
commit 0eb70e1551
2 changed files with 8 additions and 1 deletions

View File

@ -335,6 +335,7 @@ class ResticBackupper(AbstractBackupper):
with subprocess.Popen( with subprocess.Popen(
command, command,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=False, shell=False,
) as handle: ) as handle:
output = handle.communicate()[0].decode("utf-8") output = handle.communicate()[0].decode("utf-8")
@ -382,7 +383,10 @@ class ResticBackupper(AbstractBackupper):
) )
with subprocess.Popen( with subprocess.Popen(
restore_command, stdout=subprocess.PIPE, shell=False restore_command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=False,
) as handle: ) as handle:
# for some reason restore does not support # for some reason restore does not support

View File

@ -791,6 +791,9 @@ def test_operations_while_locked(backups, dummy_service):
# using lowlevel to make sure no caching interferes # using lowlevel to make sure no caching interferes
assert Backups.provider().backupper.is_initted() is True assert Backups.provider().backupper.is_initted() is True
Backups.provider().backupper.lock()
assert Backups.snapshot_restored_size(snap.id) > 0
# check that no locks were left # check that no locks were left
Backups.provider().backupper.lock() Backups.provider().backupper.lock()
Backups.provider().backupper.unlock() Backups.provider().backupper.unlock()