hdparm
This commit is contained in:
parent
596db36e10
commit
1f0e660a4d
3 changed files with 38 additions and 0 deletions
18
bundles/hdparm/items.py
Normal file
18
bundles/hdparm/items.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
previous_action = []
|
||||
|
||||
for device, options in node.metadata.get('hdparm').items():
|
||||
for option, value in options.items():
|
||||
if option == 'power_management':
|
||||
name = f'hdparm_{option}_{device}'
|
||||
actions[name] = {
|
||||
'command': f'hdparm -B {value} "{device}"',
|
||||
'unless': f'hdparm -B "{device}" | grep APM_level | cut -d= -f2 | xargs | grep -q "^{value}$"',
|
||||
'needs': [
|
||||
'pkg_apt:hdparm',
|
||||
*previous_action,
|
||||
],
|
||||
}
|
||||
else:
|
||||
raise ValueError(f'unsupported hdparm option: {option}')
|
||||
|
||||
previous_action = [f'action:{name}']
|
8
bundles/hdparm/metadata.py
Normal file
8
bundles/hdparm/metadata.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
defaults = {
|
||||
'apt': {
|
||||
'packages': {
|
||||
'hdparm': {},
|
||||
},
|
||||
},
|
||||
'hdparm': {},
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
'bundles': [
|
||||
'zfs',
|
||||
'zfs-mirror',
|
||||
'hdparm',
|
||||
],
|
||||
'metadata': {
|
||||
'id': '9cf52515-63a1-4659-a8ec-6c3c881727e5',
|
||||
|
@ -21,6 +22,17 @@
|
|||
'backup-server': {
|
||||
'hostname': 'backups.sublimity.de',
|
||||
},
|
||||
'hdparm': {
|
||||
'/dev/disk/by-id/ata-HGST_HDN726040ALE614_K3GV6TPL': {
|
||||
'power_management': 1,
|
||||
},
|
||||
'/dev/disk/by-id/ata-HGST_HDN726040ALE614_K4KAJXEB': {
|
||||
'power_management': 1,
|
||||
},
|
||||
'/dev/disk/by-id/ata-TOSHIBA_HDWQ140_19VZK0EMFAYG': {
|
||||
'power_management': 1,
|
||||
},
|
||||
},
|
||||
'zfs-mirror': {
|
||||
'server': 'wb.offsite-backups',
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue