bundles/zfs: remove support for snapshot_only and snapshot_never (unused)
This commit is contained in:
parent
b20f369ea8
commit
2fbbaa1586
3 changed files with 2 additions and 77 deletions
|
@ -31,15 +31,9 @@ label = argv[1]
|
|||
with open('/etc/zfs-snapshot-config.json', 'r') as fp:
|
||||
metadata = loads(fp.read())
|
||||
|
||||
if 'snapshot_only' in metadata:
|
||||
datasets = set(metadata['snapshot_only'])
|
||||
else:
|
||||
output = check_output(['zfs', 'list', '-H', '-o', 'name']).decode('UTF-8')
|
||||
datasets = set(output.splitlines())
|
||||
|
||||
for pattern in metadata.get('snapshot_never', set()):
|
||||
datasets = set(filter(lambda x: not re.search(pattern, x), datasets))
|
||||
|
||||
default_retain = metadata['retain_defaults'][label]
|
||||
now = datetime.now().strftime('%F-%H%M')
|
||||
snapshots_created = False
|
||||
|
|
|
@ -98,27 +98,3 @@ directories = {
|
|||
'purge': True,
|
||||
},
|
||||
}
|
||||
|
||||
# TODO implement when we start managing backups via bundlewrap
|
||||
#if node.metadata.get('zfs', {}).get('snapshots', {}).get('backup', {}).get('enabled', True):
|
||||
# directories["/mnt/zfs-snapshot-backup"] = {}
|
||||
#
|
||||
# files["/usr/local/sbin/zfs-backup-snapshot"] = {
|
||||
# 'content_type': 'mako',
|
||||
# 'context': {
|
||||
# # Set by our own metadata processor, guaranteed to exist.
|
||||
# 'filesystems': node.metadata['zfs']['snapshots']['backup']['filesystems_with_snapshot'],
|
||||
# },
|
||||
# 'mode': '0755',
|
||||
# }
|
||||
# files["/usr/local/sbin/zfs-backup-snapshot-unmount"] = {
|
||||
# 'content_type': 'mako',
|
||||
# 'context': {
|
||||
# # Set by our own metadata processor, guaranteed to exist.
|
||||
# 'filesystems': node.metadata['zfs']['snapshots']['backup']['filesystems_with_snapshot'],
|
||||
# },
|
||||
# 'mode': '0755',
|
||||
# }
|
||||
#
|
||||
#else:
|
||||
# files["/mnt/zfs-snapshot-backup"] = {'delete': True}
|
||||
|
|
|
@ -52,10 +52,6 @@ defaults = {
|
|||
'datasets': {},
|
||||
'pools': {},
|
||||
'snapshots': {
|
||||
# 'backup': {
|
||||
# 'enabled': True,
|
||||
# 'filesystems_with_snapshot': {},
|
||||
# },
|
||||
'retain_defaults': {
|
||||
'hourly': 24,
|
||||
'daily': 7,
|
||||
|
@ -99,47 +95,6 @@ def zfs_scrub_cronjob(metadata):
|
|||
}
|
||||
|
||||
|
||||
# TODO
|
||||
#@metadata_reactor
|
||||
#def zfs_snapshot_backup(metadata):
|
||||
# if metadata.get('zfs/snapshots/backup/enabled'):
|
||||
# # Collect all filesystems/datasets (e.g., "tank/mysql") which
|
||||
# # are configured for (local) snapshots. For each of them, store
|
||||
# # the mountpoint. This information will be used primarily by
|
||||
# # "/usr/local/sbin/zfs-backup-snapshot", but may also be used by
|
||||
# # other bundles (think backup tools).
|
||||
# #
|
||||
# # In other words, this API allows other bundles to check whether
|
||||
# # a path belongs to a ZFS dataset with snapshots enabled.
|
||||
#
|
||||
# filesystems = {}
|
||||
#
|
||||
# if metadata.get('zfs/snapshots/snapshot_only', None) is not None:
|
||||
# for name in metadata.get('zfs/snapshots/snapshot_only'):
|
||||
# attrs = metadata.get('zfs/datasets')[name]
|
||||
# if attrs.get('mountpoint') not in (None, "none"):
|
||||
# filesystems[name] = attrs['mountpoint']
|
||||
# else:
|
||||
# for name, attrs in metadata.get('zfs/datasets').items():
|
||||
# if attrs.get('mountpoint') not in (None, "none"):
|
||||
# filesystems[name] = attrs['mountpoint']
|
||||
#
|
||||
# for pattern in metadata.get('zfs/snapshots/snapshot_never', set()):
|
||||
# filesystems = {k: v for k, v in filesystems.items() if not re.search(pattern, k)}
|
||||
#
|
||||
# return {
|
||||
# 'zfs': {
|
||||
# 'snapshots': {
|
||||
# 'backup': {
|
||||
# 'filesystems_with_snapshot': filesystems,
|
||||
# },
|
||||
# },
|
||||
# },
|
||||
# }
|
||||
# else:
|
||||
# return {}
|
||||
|
||||
|
||||
@metadata_reactor
|
||||
def monitoring(metadata):
|
||||
if not node.has_bundle('sshmon'):
|
||||
|
|
Loading…
Reference in a new issue