storage classes

This commit is contained in:
mwiegand 2022-06-23 02:12:11 +02:00
parent 12268daad6
commit 7243ad9e9b
4 changed files with 27 additions and 8 deletions

View file

@ -6,7 +6,7 @@ directories = {
'group': 'postgres', 'group': 'postgres',
'needs': [ 'needs': [
'pkg_apt:postgresql', 'pkg_apt:postgresql',
'zfs_dataset:tank/postgresql', f"zfs_dataset:{node.metadata.get('zfs/storage_classes/ssd')}/postgresql",
], ],
'needed_by': [ 'needed_by': [
'svc_systemd:postgresql', 'svc_systemd:postgresql',

View file

@ -1,3 +1,6 @@
from importlib.metadata import metadata
root_password = repo.vault.password_for(f'{node.name} postgresql root') root_password = repo.vault.password_for(f'{node.name} postgresql root')
defaults = { defaults = {
@ -23,13 +26,22 @@ defaults = {
'grafana_rows': set(), 'grafana_rows': set(),
} }
if node.has_bundle('zfs'):
defaults['zfs'] = { @metadata_reactor.provides(
'datasets': { 'zfs/datasets',
'tank/postgresql': { )
'mountpoint': '/var/lib/postgresql', def zfs(metadata):
'recordsize': '8192', if not node.has_bundle('zfs'):
'atime': 'off', return {}
return {
'zfs': {
'datasets': {
f"{metadata.get('zfs/storage_classes/ssd')}/postgresql": {
'mountpoint': '/var/lib/postgresql',
'recordsize': '8192',
'atime': 'off',
},
}, },
}, },
} }

View file

@ -78,9 +78,13 @@ defaults = {
'datasets': {}, 'datasets': {},
'pools': {}, 'pools': {},
'kernel_params': {}, 'kernel_params': {},
'storage_classes': {
'ssd': 'tank',
},
}, },
} }
@metadata_reactor.provides( @metadata_reactor.provides(
'zfs/datasets' 'zfs/datasets'
) )

View file

@ -136,6 +136,9 @@
}, },
'zfs': { 'zfs': {
'zfs_arc_max_percent': 75, 'zfs_arc_max_percent': 75,
'storage_classes': {
'ssd': 'ssd',
},
'pools': { 'pools': {
'tank': { 'tank': {
'type': 'mirror', 'type': 'mirror',