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',
'needs': [
'pkg_apt:postgresql',
'zfs_dataset:tank/postgresql',
f"zfs_dataset:{node.metadata.get('zfs/storage_classes/ssd')}/postgresql",
],
'needed_by': [
'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')
defaults = {
@ -23,13 +26,22 @@ defaults = {
'grafana_rows': set(),
}
if node.has_bundle('zfs'):
defaults['zfs'] = {
'datasets': {
'tank/postgresql': {
'mountpoint': '/var/lib/postgresql',
'recordsize': '8192',
'atime': 'off',
@metadata_reactor.provides(
'zfs/datasets',
)
def zfs(metadata):
if not node.has_bundle('zfs'):
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': {},
'pools': {},
'kernel_params': {},
'storage_classes': {
'ssd': 'tank',
},
},
}
@metadata_reactor.provides(
'zfs/datasets'
)

View file

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