Files
mesh-catalog/modules/zfs/module.json
T
jochen bd0182785c
mesh/merge-gate pass: builds zfs, sent nowhere; no bus step; every machine composes with the change as it did without (4 of 4 compose)
mesh/repo-check pass: its merge-check.sh passed
mesh/delivery superseded: a newer head of the same pull request
Run the scrub schedule as a scheduled process, never pause a scrub, and keep the pool's name the only setting in a unit
The second review of #147 found three blockers before the home server.

1. ${setting:} was not filled in a unit's name, so the distribution timers would have reached the
   machine as "zfs-scrub-weekly@${setting:scrub-pool}.timer". mesh-controller #171 fills it and refuses
   any value that is not a unit-name part. The module's own schedule needs no setting in a name now: the
   node-engine's timer for the scheduled process zfs-mesh-scrub fires `zfs-tools scrub-run` every quarter
   of an hour, and the run reads the pool, cadence, day and time from the configuration file.
2. The run does what upstream's zfs-scrub@.service does: if a scrub is running it waits for it with
   zpool wait -t scrub, otherwise it starts one and waits. It never pauses or stops a scrub, and the unit
   has no ExecStop. A resilver defers the scrub. The served slot is kept in /var/lib/zfs-tools.
3. Unassigning left the pool with no schedule. mesh-host #66 (hq ADR 0269, proposed) gives the
   distribution timer back running and enabled. The README says not to unassign before it is merged.

Also: the run comes before the distribution timers in the declaration; the day and time are checked
against fixed sets and reach no unit file (an invalid value runs nothing); a due scrub not started an
hour after its time is a warning; the error counts outlive a restart in a small state file.
2026-10-09 01:40:02 +02:00

198 lines
4.7 KiB
JSON

{
"module": "zfs",
"version": "1",
"capabilities": [
"service-manager"
],
"emits": [
"snapshot.taken",
"scrub.requested"
],
"settings": {
"scrub-cadence": {
"kind": "preference",
"default": "weekly",
"why": "how often the pool named by scrub-pool is scrubbed, weekly or monthly (the first scrub-day of each month); weekly is what the distribution's timer did on the home server before the module, so taking it over moves nothing until the operator chooses"
},
"scrub-day": {
"kind": "preference",
"default": "Mon",
"why": "the weekday the scrub starts, Mon to Sun: for a monthly scrub, the first such day of the month. Checked by the scheduled run, which refuses any other value and runs nothing; Monday is when the distribution's weekly timer fired"
},
"scrub-time": {
"kind": "preference",
"default": "00:00",
"why": "the time the scrub starts, HH:MM from 00:00 to 23:59 in the machine's time zone; the scheduled run checks it every quarter of an hour, so the scrub starts within 15 minutes of it. Midnight is when the distribution's weekly timer fired"
}
},
"tools": [
"zfs_datasets",
"zfs_snapshots",
"zfs_snapshot",
"zfs_pools",
"zfs_space",
"zfs_pool_layout",
"zfs_scrub",
"zfs_scrub_start",
"zfs_scrub_pause",
"zfs_scrub_stop",
"zfs_io",
"zfs_arc",
"zfs_events",
"zfs_properties",
"zfs_health"
],
"replaces": {
"zfs_datasets": [
"zfs list"
],
"zfs_snapshots": [
"zfs list -t snapshot"
],
"zfs_snapshot": [
"zfs snapshot"
],
"zfs_pools": [
"zpool list",
"zpool status -x"
],
"zfs_space": [
"zfs list -o space",
"zpool list -v"
],
"zfs_pool_layout": [
"zpool status",
"zpool status -v"
],
"zfs_scrub": [
"zpool history -i"
],
"zfs_io": [
"zpool iostat",
"zpool iostat -v"
],
"zfs_arc": [
"arcstat",
"arc_summary",
"cat /proc/spl/kstat/zfs/arcstats"
],
"zfs_events": [
"zpool events",
"zpool events -v"
],
"zfs_properties": [
"zfs get all",
"zfs get"
],
"zfs_scrub_start": [
"zpool scrub"
],
"zfs_scrub_pause": [
"zpool scrub -p"
],
"zfs_scrub_stop": [
"zpool scrub -s"
]
},
"resources": [
{
"id": "watch",
"type": "process",
"name": "zfs-watch",
"artifact": "tools",
"run": [
"./zfs-tools",
"watch"
],
"user": "${machine:account}",
"health": {
"kind": "tool",
"tool": "zfs_health",
"interval": "60s",
"timeout": "20s",
"looks": 2,
"grace": "60s"
}
},
{
"id": "state-dir",
"type": "directory",
"path": "/var/lib/zfs-tools",
"mode": "0755",
"owner": "${machine:account}"
},
{
"id": "cursor-dir",
"type": "directory",
"path": "/run/zfs-events",
"mode": "0700"
},
{
"id": "events",
"type": "process",
"name": "zfs-events",
"artifact": "tools",
"run": [
"./zfs-tools",
"events"
],
"health": {
"kind": "unit"
}
},
{
"id": "config-dir",
"type": "directory",
"path": "/etc/zfs-tools",
"mode": "0755"
},
{
"id": "scrub-config",
"type": "file",
"path": "/etc/zfs-tools/scrub.conf",
"mode": "0644",
"content": "# Written by the mesh (module zfs) from this machine's assignment. Replaced on every push; change the\n# settings scrub-pool, scrub-cadence, scrub-day and scrub-time, never this file. The module's tools read it.\npool=${setting:scrub-pool}\ncadence=${setting:scrub-cadence}\nday=${setting:scrub-day}\ntime=${setting:scrub-time}\n"
},
{
"id": "scrub-run",
"type": "process",
"name": "zfs-mesh-scrub",
"artifact": "tools",
"run": [
"./zfs-tools",
"scrub-run"
],
"schedule": "*/15 * * * *"
},
{
"id": "distribution-weekly",
"type": "service",
"unit": "zfs-scrub-weekly@${setting:scrub-pool}.timer",
"state": "stopped",
"boot": "disabled"
},
{
"id": "distribution-monthly",
"type": "service",
"unit": "zfs-scrub-monthly@${setting:scrub-pool}.timer",
"state": "stopped",
"boot": "disabled"
}
],
"build": {
"artifacts": [
{
"name": "tools",
"kind": "bundle",
"language": "go",
"system": "arch",
"from": "cmd/zfs-tools",
"binary": "zfs-tools",
"loads": [
"zfs-tools"
]
}
]
}
}