forked from third-party-mirrors/zfs_autobackup
Change --snapshot-property to --set-snapshot-properties to behave in the same was as --set-properties
This commit is contained in:
parent
911db9b023
commit
3f1696024e
@ -70,8 +70,8 @@ class ZfsAutobackup(ZfsAuto):
|
||||
help='If nothing has changed, still create empty snapshots. (Faster. Same as --min-change=0)')
|
||||
group.add_argument('--other-snapshots', action='store_true',
|
||||
help='Send over other snapshots as well, not just the ones created by this tool.')
|
||||
group.add_argument('--snapshot-property', metavar='PROPERTY=VALUE', default=None,
|
||||
help='Property to set during snapshot (argument to zfs snapshot)')
|
||||
group.add_argument('--set-snapshot-properties', metavar='PROPERTY=VALUE,...', type=str,
|
||||
help='List of properties to set on the snapshot.')
|
||||
|
||||
|
||||
group = parser.add_argument_group("Transfer options")
|
||||
@ -414,6 +414,15 @@ class ZfsAutobackup(ZfsAuto):
|
||||
|
||||
return set_properties
|
||||
|
||||
def set_snapshot_properties_list(self):
|
||||
|
||||
if self.args.set_snapshot_properties:
|
||||
set_snapshot_properties = self.args.set_snapshot_properties.split(",")
|
||||
else:
|
||||
set_snapshot_properties = []
|
||||
|
||||
return set_snapshot_properties
|
||||
|
||||
def run(self):
|
||||
|
||||
try:
|
||||
@ -450,7 +459,7 @@ class ZfsAutobackup(ZfsAuto):
|
||||
min_changed_bytes=self.args.min_change,
|
||||
pre_snapshot_cmds=self.args.pre_snapshot_cmd,
|
||||
post_snapshot_cmds=self.args.post_snapshot_cmd,
|
||||
snapshot_property=self.args.snapshot_property)
|
||||
set_snapshot_properties=self.set_snapshot_properties_list())
|
||||
|
||||
################# sync
|
||||
# if target is specified, we sync the datasets, otherwise we just thin the source. (e.g. snapshot mode)
|
||||
|
@ -180,7 +180,7 @@ class ZfsNode(ExecuteNode):
|
||||
self.logger.debug("{} {}".format(self.description, txt))
|
||||
|
||||
def consistent_snapshot(self, datasets, snapshot_name, min_changed_bytes, pre_snapshot_cmds=[],
|
||||
post_snapshot_cmds=[], snapshot_property=None):
|
||||
post_snapshot_cmds=[], set_snapshot_properties=[]):
|
||||
"""create a consistent (atomic) snapshot of specified datasets, per pool.
|
||||
"""
|
||||
|
||||
@ -218,7 +218,7 @@ class ZfsNode(ExecuteNode):
|
||||
# create consistent snapshot per pool
|
||||
for (pool_name, snapshots) in pools.items():
|
||||
cmd = ["zfs", "snapshot"]
|
||||
if snapshot_property:
|
||||
for snapshot_property in set_snapshot_properties
|
||||
cmd += ['-o', snapshot_property]
|
||||
|
||||
cmd.extend(map(lambda snapshot_: str(snapshot_), snapshots))
|
||||
|
Loading…
x
Reference in New Issue
Block a user