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:
Rusty Bird 2018-02-16 21:47:36 +00:00
parent ade49d44b7
commit f6542effc5
No known key found for this signature in database
GPG Key ID: 469D78F47AAF2ADF

View File

@ -262,7 +262,8 @@ class ThinVolume(qubes.storage.Volume):
if revisions is None:
revisions = sorted(self.revisions.items(),
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]
for rev_id in revisions: