Make the serial port and disk glob per host

The shelf moved from iz-pve1 to iz-pve0, which has two SAS HBAs and an
internal backplane that is itself behind an expander. The default
"*-sas-exp*" glob matched all 17 drives there, so the shelf's fans would
have been set from the server's own drive temperatures.

PORT and DISK_GLOB are now overridable from the unit. Documents that the
host holding the shelf also needs the mirror-image DISK_EXCLUDE_PATTERN
in fan_speed.service - it was counting 17 disks until that was set.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Zeb Hering
2026-08-30 16:36:15 -07:00
parent 24d53e832e
commit 0fe728e28a
2 changed files with 20 additions and 5 deletions

View File

@@ -131,9 +131,20 @@ between keepalives, lower it.
- Only one process may talk to the serial port. The script takes an exclusive `flock` on
`/run/das_fanctl.lock` and exits rather than interleaving garbage with another writer.
Detach `attachDAS.sh`'s `screen` session before starting the service.
- The disk glob is `/dev/disk/by-path/*-sas-exp*-lun-0` — anything behind a SAS expander,
i.e. the shelf. The host's own drives hang off `pci-…-scsi-*` and are not matched. A
second enclosure would be lumped in with the first.
- **`DISK_GLOB` must name the shelf's HBA on any host with more than one.** The default
`*-sas-exp*-lun-0` means "behind a SAS expander", which is not the same as "in the
shelf": a server's own backplane is frequently behind an expander too. On `iz-pve0` the
internal drives sit on `pci-0000:02:00.0` and the shelf on `pci-0000:04:00.0`, so the
default glob matched all 17 drives and would have set the shelf's fans from the
server's internal drive temperatures. Set
`Environment=DISK_GLOB=/dev/disk/by-path/*04:00.0*-lun-0` in the unit.
- **The server's own fan controller needs the mirror-image setting.** Whichever host the
shelf is plugged into must set `DISK_EXCLUDE_PATTERN` to that same HBA in
`fan_speed.service`, or the shelf's drives drive the *server* fans as well. Moving the
shelf between hosts means moving both settings.
- `PORT` is per host too. Check which UART actually answers rather than assuming:
`grep -v uart:unknown /proc/tty/driver/serial` lists the real ones, then send
`_temp_rd` to each and watch for the `BlueDress` prompt.
## Files

View File

@@ -7,7 +7,7 @@
source /root/fan_speed/functions.sh
PORT=/dev/ttyS1
PORT=${PORT:-/dev/ttyS1}
LOG=/root/fan_speed/log/das_fan.log
CHECK_INTERVAL=30 # seconds between temperature readings
KEEPALIVE_INTERVAL=5 # re-send _shutup this often, the DAS forgets it otherwise
@@ -16,7 +16,11 @@ HIGH_FAN_SPEED=60
# Disks in the enclosure - anything behind the DAS SAS expander. The server's own
# drives hang off pci-...-scsi-* instead, so this glob does not pick them up.
DISK_GLOB='/dev/disk/by-path/*-sas-exp*-lun-0'
# Drives in THIS shelf. "-sas-exp" alone is not enough to identify an enclosure:
# a server's own backplane is often behind an expander too, and on iz-pve0 the
# internal drives sit on pci-0000:02:00.0 while the shelf is on 04:00.0. Name the
# shelf's HBA explicitly on any host with more than one.
DISK_GLOB=${DISK_GLOB:-/dev/disk/by-path/*-sas-exp*-lun-0}
DISK_LOW_TEMPERATURE_THRESHOLD=40 # at/below this -> LOW_FAN_SPEED (idle spread is 32-39c)
DISK_HIGH_TEMPERATURE_THRESHOLD=50 # at/above this -> HIGH_FAN_SPEED