option to clear refreservation for new filesystems

This commit is contained in:
Edwin Eefting 2016-02-17 17:14:09 +01:00
parent 1e4e88d022
commit b2f6743721

View File

@ -348,6 +348,7 @@ parser.add_argument('--no-snapshot', action='store_true', help='dont create new
parser.add_argument('--no-send', action='store_true', help='dont send snapshots (usefull to only do a cleanup)')
parser.add_argument('--destroy-stale', action='store_true', help='Destroy stale backups that have no more snapshots. Be sure to verify the output before using this! ')
parser.add_argument('--clear-refreservation', action='store_true', help='Set refreservation property to none for new filesystems. Usefull when backupping SmartOS volumes.')
parser.add_argument('--compress', action='store_true', help='use compression during zfs send/recv')
parser.add_argument('--test', action='store_true', help='dont change anything, just show what would be done (still does all read-only operations)')
@ -451,8 +452,14 @@ for source_filesystem in source_filesystems:
ssh_target=args.ssh_target, target_filesystem=target_filesystem)
#now that we succesfully transferred this snapshot, the previous snapshot is obsolete:
if latest_target_snapshot:
target_obsolete_snapshots[target_filesystem].append(latest_target_snapshot)
source_obsolete_snapshots[source_filesystem].append(latest_target_snapshot)
#we just received a new filesytem?
else:
if args.clear_refreservation:
debug("Clearing refreservation to save space.")
run(ssh_to=args.ssh_target, test=args.test, cmd=["zfs", "set", "refreservation=none", target_filesystem ])
latest_target_snapshot=send_snapshot
@ -499,4 +506,3 @@ if target_destroys:
verbose("All done")