also changed internal logic: thinner now isnt actually created when --no-thinning is active.

When using --no-thinning --no-snapshot --no-send it still does usefull stuff like checking common snapshots and showing incompatible snapshots
This commit is contained in:
Edwin Eefting
2021-04-18 14:30:23 +02:00
parent 352d5e6094
commit ec1d3ff93e
4 changed files with 61 additions and 49 deletions

View File

@ -16,7 +16,7 @@ class ZfsNode(ExecuteNode):
"""a node that contains zfs datasets. implements global (systemwide/pool wide) zfs commands"""
def __init__(self, backup_name, logger, ssh_config=None, ssh_to=None, readonly=False, description="",
debug_output=False, thinner=Thinner()):
debug_output=False, thinner=None):
self.backup_name = backup_name
self.description = description
@ -30,14 +30,15 @@ class ZfsNode(ExecuteNode):
else:
self.verbose("Datasets are local")
rules = thinner.human_rules()
if rules:
for rule in rules:
self.verbose(rule)
else:
self.verbose("Keep no old snaphots")
if thinner is not None:
rules = thinner.human_rules()
if rules:
for rule in rules:
self.verbose(rule)
else:
self.verbose("Keep no old snaphots")
self.thinner = thinner
self.__thinner = thinner
# list of ZfsPools
self.__pools = {}
@ -47,6 +48,12 @@ class ZfsNode(ExecuteNode):
ExecuteNode.__init__(self, ssh_config=ssh_config, ssh_to=ssh_to, readonly=readonly, debug_output=debug_output)
def thin(self, objects, keep_objects):
if self.__thinner is not None:
return self.__thinner.thin(objects, keep_objects)
else:
return ( keep_objects, [] )
@CachedProperty
def supported_send_options(self):
"""list of supported options, for optimizing sends"""