bundles/zfs: introduce zfs-snapshot-backups, enable backups for nodes which need zfs-snapshot-backups
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2021-05-15 20:32:23 +02:00
parent 93e36156a0
commit 479b730be4
Signed by: kunsi
GPG key ID: 12E3D2136B818350
11 changed files with 96 additions and 18 deletions

View file

@ -104,7 +104,9 @@ def zfs_scrub_cronjob(metadata):
}
@metadata_reactor
@metadata_reactor.provides(
'icinga2_api/zfs/services',
)
def monitoring(metadata):
if not node.has_bundle('sshmon'):
raise DoNotRunAgain
@ -129,3 +131,25 @@ def monitoring(metadata):
},
},
}
@metadata_reactor.provides(
'zfs/filesystems_with_backup_snapshots',
)
def backups_with_snapshot(metadata):
backups = metadata.get('backups/paths', set())
datasets = metadata.get('zfs/datasets', {})
backups_in_zfs_datasets = {}
for path in backups:
for dname, dconfig in datasets.items():
if 'mountpoint' in dconfig:
if path[:len(dconfig['mountpoint'])] == dconfig['mountpoint']:
backups_in_zfs_datasets.setdefault(dname, set()).add(path)
return {
'zfs': {
'filesystems_with_backup_snapshots': backups_in_zfs_datasets,
},
}