dont autosnapshot backup datasets

This commit is contained in:
mwiegand 2021-11-12 17:40:00 +01:00
parent 72561bdb52
commit 706af2e127

View file

@ -28,35 +28,45 @@ def zfs(metadata):
other_node.has_bundle('backup') and other_node.has_bundle('backup') and
other_node.metadata.get('backup/server') == node.name other_node.metadata.get('backup/server') == node.name
): ):
base_dataset = f"tank/{other_node.metadata.get('id')}"
# container # container
datasets[f"tank/{other_node.metadata.get('id')}"] = { datasets[base_dataset] = {
'mountpoint': None, 'mountpoint': None,
'readonly': 'on', 'readonly': 'on',
'backup': False, 'backup': False,
'com.sun:auto-snapshot': 'false',
} }
# for rsync backups # for rsync backups
datasets[f"tank/{other_node.metadata.get('id')}/fs"] = { datasets[f'{base_dataset}/fs'] = {
'mountpoint': f"/mnt/backups/{other_node.metadata.get('id')}", 'mountpoint': f"/mnt/backups/{other_node.metadata.get('id')}",
'readonly': 'off', 'readonly': 'off',
'backup': False, 'backup': False,
'com.sun:auto-snapshot': 'true',
} }
# for zfs send/recv # for zfs send/recv
if other_node.has_bundle('zfs'): if other_node.has_bundle('zfs'):
# base datasets for each tank # base datasets for each tank
for pool in other_node.metadata.get('zfs/pools'): for pool in other_node.metadata.get('zfs/pools'):
datasets[f"tank/{other_node.metadata.get('id')}/{pool}"] = { datasets[f'{base_dataset}/{pool}'] = {
'mountpoint': None, 'mountpoint': None,
'readonly': 'on', 'readonly': 'on',
'backup': False, 'backup': False,
'com.sun:auto-snapshot': 'false',
} }
# actual datasets # actual datasets
for path in other_node.metadata.get('backup/paths'): for path in other_node.metadata.get('backup/paths'):
for dataset, config in other_node.metadata.get('zfs/datasets').items(): for dataset, config in other_node.metadata.get('zfs/datasets').items():
if path == config.get('mountpoint'): if path == config.get('mountpoint'):
datasets[f"tank/{other_node.metadata.get('id')}/{dataset}"] = { datasets[f'{base_dataset}/{dataset}'] = {
'mountpoint': None, 'mountpoint': None,
'readonly': 'on', 'readonly': 'on',
'backup': False, 'backup': False,
'com.sun:auto-snapshot': 'false',
} }
continue continue