zpool: Add slot power control, print power status
commit69142125d75b7405e0f1cf141dbe7913448daedf
authorTony Hutter <hutter2@llnl.gov>
Thu, 21 Dec 2023 18:53:16 +0000 (21 10:53 -0800)
committerTony Hutter <hutter2@llnl.gov>
Mon, 29 Jan 2024 23:12:06 +0000 (29 15:12 -0800)
tree26de02691ede11de6ea1fe6e772920a309d450dc
parent59112ca27d94edd793dbfda6ed5d2fc7a97dddaa
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
16 files changed:
cmd/zpool/os/freebsd/zpool_vdev_os.c
cmd/zpool/os/linux/zpool_vdev_os.c
cmd/zpool/zpool_iter.c
cmd/zpool/zpool_main.c
cmd/zpool/zpool_util.h
include/libzfs.h
include/libzutil.h
lib/libzfs/libzfs.abi
lib/libzfs/libzfs_pool.c
lib/libzutil/os/linux/zutil_import_os.c
lib/libzutil/zutil_import.c
lib/libzutil/zutil_pool.c
man/man8/zpool-clear.8
man/man8/zpool-offline.8
man/man8/zpool-status.8
man/man8/zpool.8