forked from third-party-mirrors/zfs_autobackup
Add --snapshot-property argument to pass to zfs snapshot
This commit is contained in:
parent
4873913fa8
commit
911db9b023
@ -70,6 +70,9 @@ 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 = parser.add_argument_group("Transfer options")
|
||||
group.add_argument('--no-send', action='store_true',
|
||||
@ -446,7 +449,8 @@ class ZfsAutobackup(ZfsAuto):
|
||||
source_node.consistent_snapshot(source_datasets, snapshot_name,
|
||||
min_changed_bytes=self.args.min_change,
|
||||
pre_snapshot_cmds=self.args.pre_snapshot_cmd,
|
||||
post_snapshot_cmds=self.args.post_snapshot_cmd)
|
||||
post_snapshot_cmds=self.args.post_snapshot_cmd,
|
||||
snapshot_property=self.args.snapshot_property)
|
||||
|
||||
################# 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=[]):
|
||||
post_snapshot_cmds=[], snapshot_property=None):
|
||||
"""create a consistent (atomic) snapshot of specified datasets, per pool.
|
||||
"""
|
||||
|
||||
@ -218,6 +218,8 @@ class ZfsNode(ExecuteNode):
|
||||
# create consistent snapshot per pool
|
||||
for (pool_name, snapshots) in pools.items():
|
||||
cmd = ["zfs", "snapshot"]
|
||||
if snapshot_property:
|
||||
cmd += ['-o', snapshot_property]
|
||||
|
||||
cmd.extend(map(lambda snapshot_: str(snapshot_), snapshots))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user