lvm_thin: _remove_revisions() on revisions_to_keep==0
If revisions_to_keep is 0, it may nevertheless have been > 0 before, so it makes sense to call _remove_revisions() and hold back none (not all) of the revisions in this case.
This commit is contained in:
parent
ade49d44b7
commit
f6542effc5
@ -262,7 +262,8 @@ class ThinVolume(qubes.storage.Volume):
|
|||||||
if revisions is None:
|
if revisions is None:
|
||||||
revisions = sorted(self.revisions.items(),
|
revisions = sorted(self.revisions.items(),
|
||||||
key=operator.itemgetter(1))
|
key=operator.itemgetter(1))
|
||||||
revisions = revisions[:-self.revisions_to_keep]
|
# pylint: disable=invalid-unary-operand-type
|
||||||
|
revisions = revisions[:(-self.revisions_to_keep) or None]
|
||||||
revisions = [rev_id for rev_id, _ in revisions]
|
revisions = [rev_id for rev_id, _ in revisions]
|
||||||
|
|
||||||
for rev_id in revisions:
|
for rev_id in revisions:
|
||||||
@ -287,7 +288,7 @@ class ThinVolume(qubes.storage.Volume):
|
|||||||
'{}-{}-back'.format(self.vid, int(time.time()))]
|
'{}-{}-back'.format(self.vid, int(time.time()))]
|
||||||
qubes_lvm(cmd, self.log)
|
qubes_lvm(cmd, self.log)
|
||||||
reset_cache()
|
reset_cache()
|
||||||
self._remove_revisions()
|
self._remove_revisions()
|
||||||
|
|
||||||
# TODO: when converting this function to coroutine, this _must_ be
|
# TODO: when converting this function to coroutine, this _must_ be
|
||||||
# under a lock
|
# under a lock
|
||||||
|
Loading…
Reference in New Issue
Block a user