diff options
author | Tony Hutter <[email protected]> | 2017-02-10 16:09:45 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-02-10 16:09:45 -0800 |
commit | b291029e8661dfc2f03118921e854eec4e5bbb75 (patch) | |
tree | 6df732938171565a0dc1a82778e28101a6511f26 /cmd/zpool/zpool_iter.c | |
parent | 65a736bc0df16561bac14bee6bf9a6752cf8bc39 (diff) |
Enclosure LED fixes
- Pass $VDEV_ENC_SYSFS_PATH to 'zpool [iostat|status] -c' to include
enclosure LED sysfs path.
- Set LEDs correctly after import. This includes clearing any erroniously
set LEDs prior to the import, and setting the LED for any UNAVAIL drives.
- Include symlink for vdev_attach-led.sh in Makefile.am.
- Print the VDEV path in all-syslog.sh, and fix it so the pool GUID actually
prints.
Reviewed-by: Don Brady <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes #5716
Closes #5751
Diffstat (limited to 'cmd/zpool/zpool_iter.c')
-rw-r--r-- | cmd/zpool/zpool_iter.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/cmd/zpool/zpool_iter.c b/cmd/zpool/zpool_iter.c index e93dc0f89..7ce0ccf9e 100644 --- a/cmd/zpool/zpool_iter.c +++ b/cmd/zpool/zpool_iter.c @@ -332,9 +332,11 @@ vdev_run_cmd_thread(void *cb_cmd_data) char cmd[_POSIX_ARG_MAX]; /* Set our VDEV_PATH and VDEV_UPATH env vars and run command */ - if (snprintf(cmd, sizeof (cmd), "VDEV_PATH=%s && VDEV_UPATH=%s && %s", - data->path, data->upath ? data->upath : "\"\"", data->cmd) >= - sizeof (cmd)) { + if (snprintf(cmd, sizeof (cmd), "VDEV_PATH=%s && VDEV_UPATH=\"%s\" && " + "VDEV_ENC_SYSFS_PATH=\"%s\" && %s", data->path ? data->path : "", + data->upath ? data->upath : "", + data->vdev_enc_sysfs_path ? data->vdev_enc_sysfs_path : "", + data->cmd) >= sizeof (cmd)) { /* Our string was truncated */ return; } @@ -364,11 +366,15 @@ for_each_vdev_run_cb(zpool_handle_t *zhp, nvlist_t *nv, void *cb_vcdl) vdev_cmd_data_t *data; char *path = NULL; char *vname = NULL; + char *vdev_enc_sysfs_path = NULL; int i, match = 0; if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) != 0) return (1); + nvlist_lookup_string(nv, ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH, + &vdev_enc_sysfs_path); + /* Spares show more than once if they're in use, so skip if exists */ for (i = 0; i < vcdl->count; i++) { if ((strcmp(vcdl->data[i].path, path) == 0) && @@ -406,6 +412,10 @@ for_each_vdev_run_cb(zpool_handle_t *zhp, nvlist_t *nv, void *cb_vcdl) data->path = strdup(path); data->upath = zfs_get_underlying_path(path); data->cmd = vcdl->cmd; + if (vdev_enc_sysfs_path) + data->vdev_enc_sysfs_path = strdup(vdev_enc_sysfs_path); + else + data->vdev_enc_sysfs_path = NULL; vcdl->count++; @@ -500,6 +510,7 @@ free_vdev_cmd_data_list(vdev_cmd_data_list_t *vcdl) free(vcdl->data[i].pool); free(vcdl->data[i].upath); free(vcdl->data[i].line); + free(vcdl->data[i].vdev_enc_sysfs_path); } free(vcdl->data); free(vcdl); |