Skip to content

Commit 1a8dcc0

Browse files
committed
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 `-0|-1` flags are added to `zpool offline|online|clear`: zpool offline -0 <pool> <device> Turn off device slot power zpool online -1 <pool> <device> Turn on device slot power zpool clear -1 <pool> [device] Turn on device slot power If the ZPOOL_AUTO_POWER_ON_SLOT env var is set, then the '-1' is automatically implied for `zpool online` and `zpool clear` and does not need to be passed. `zpool status` also gets a `-1` option to print the slot power status. Signed-off-by: Tony Hutter <[email protected]>
1 parent 687e4d7 commit 1a8dcc0

File tree

11 files changed

+677
-43
lines changed

11 files changed

+677
-43
lines changed

cmd/zpool/zpool_iter.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,10 @@ for_each_vdev_run_cb(void *zhp_data, nvlist_t *nv, void *cb_vcdl)
554554
if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) != 0)
555555
return (1);
556556

557+
/* Make sure we're getting the updated enclosure sysfs path */
558+
update_vdev_config_dev_sysfs_path(nv, path,
559+
ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH);
560+
557561
nvlist_lookup_string(nv, ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH,
558562
&vdev_enc_sysfs_path);
559563

0 commit comments

Comments
 (0)