zpool: Add slot power control, print power status

Add `zpool` flags to control the slot power to drives.  This assumes
your SAS or NVMe enclosure supports slot power control via sysfs.

The new `--power` flag is added to `zpool offline|online|clear`:

    zpool offline --power <pool> <device>    Turn off device slot power
    zpool online --power <pool> <device>     Turn on device slot power
    zpool clear --power <pool> [device]      Turn on device slot power

If the ZPOOL_AUTO_POWER_ON_SLOT env var is set, then the '--power'
option is automatically implied for `zpool online` and `zpool clear`
and does not need to be passed.

zpool status also gets a --power option to print the slot power status.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Mart Frauenlob <AllKind@fastest.cc>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #15662
This commit is contained in:
Tony Hutter
2023-12-21 10:53:16 -08:00
parent 59112ca27d
commit 69142125d7
16 changed files with 875 additions and 65 deletions
+11
View File
@@ -36,6 +36,7 @@
.Sh SYNOPSIS
.Nm zpool
.Cm clear
.Op Fl -power
.Ar pool
.Oo Ar device Oc Ns …
.
@@ -52,6 +53,16 @@ Pools with
enabled which have been suspended cannot be resumed.
While the pool was suspended, it may have been imported on
another host, and resuming I/O could result in pool damage.
.Bl -tag -width Ds
.It Fl -power
Power on the devices's slot in the storage enclosure and wait for the device
to show up before attempting to clear errors.
This is done on all the devices specified.
Alternatively, you can set the
.Sy ZPOOL_AUTO_POWER_ON_SLOT
environment variable to always enable this behavior.
Note: This flag currently works on Linux only.
.El
.
.Sh SEE ALSO
.Xr zdb 8 ,