Skip to content

Commit

Permalink
zpool: Add slot power control, print power status
Browse files Browse the repository at this point in the history
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 <hutter2@llnl.gov>
  • Loading branch information
tonyhutter committed Dec 9, 2023
1 parent 687e4d7 commit 1a8dcc0
Show file tree
Hide file tree
Showing 11 changed files with 677 additions and 43 deletions.
4 changes: 4 additions & 0 deletions cmd/zpool/zpool_iter.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,10 @@ for_each_vdev_run_cb(void *zhp_data, nvlist_t *nv, void *cb_vcdl)
if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) != 0)
return (1);

/* Make sure we're getting the updated enclosure sysfs path */
update_vdev_config_dev_sysfs_path(nv, path,
ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH);

nvlist_lookup_string(nv, ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH,
&vdev_enc_sysfs_path);

Expand Down
Loading

0 comments on commit 1a8dcc0

Please sign in to comment.