diff options
author | Tony Hutter <[email protected]> | 2016-12-16 16:10:45 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-12-16 16:10:45 -0800 |
commit | 1528bfdb148b44eaa0522109fee1ab61f4f3214b (patch) | |
tree | 74da77e5a11483e4acdec247821ec54eb90974e2 /cmd/zpool/zpool_main.c | |
parent | 81eb8a1fbb5dae86bebdc6c518071ae3ab062e3f (diff) |
Don't run 'zpool iostat -c CMD' command on all vdevs, if vdevs specified
zpool iostat allows you to specify only certain vdevs to display.
Currently, if you run 'zpool iostat -c CMD vdev1 vdev2 ...'
on specific vdevs, it will actually run the command on *all* vdevs,
and just display the results for the vdevs you specify. This patch
corrects the behavior to only run the command on the specified vdevs,
and also enables the zpool_iostat_005_pos.ksh tests.
Reviewed-by: Giuseppe Di Natale <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes #5443
Diffstat (limited to 'cmd/zpool/zpool_main.c')
-rw-r--r-- | cmd/zpool/zpool_main.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index a8233e336..f5740c00e 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -312,7 +312,7 @@ get_usage(zpool_help_t idx) { "[-R root] [-F [-n]]\n" "\t <pool | id> [newpool]\n")); case HELP_IOSTAT: - return (gettext("\tiostat [-T d | u] [-ghHLpPvy] " + return (gettext("\tiostat [-c CMD] [-T d | u] [-ghHLpPvy] " "[[-lq]|[-r|-w]]\n" "\t [[pool ...]|[pool vdev ...]|[vdev ...]] " "[interval [count]]\n")); @@ -335,8 +335,8 @@ get_usage(zpool_help_t idx) { case HELP_SCRUB: return (gettext("\tscrub [-s] <pool> ...\n")); case HELP_STATUS: - return (gettext("\tstatus [-gLPvxD] [-T d|u] [pool] ... " - "[interval [count]]\n")); + return (gettext("\tstatus [-c CMD] [-gLPvxD] [-T d|u] [pool]" + " ... [interval [count]]\n")); case HELP_UPGRADE: return (gettext("\tupgrade\n" "\tupgrade -v\n" @@ -4055,8 +4055,13 @@ zpool_do_iostat(int argc, char **argv) usage(B_FALSE); break; case '?': - (void) fprintf(stderr, gettext("invalid option '%c'\n"), - optopt); + if (optopt == 'c') { + fprintf(stderr, + gettext("Missing CMD for -c\n")); + } else { + fprintf(stderr, + gettext("invalid option '%c'\n"), optopt); + } usage(B_FALSE); } } @@ -4256,9 +4261,10 @@ zpool_do_iostat(int argc, char **argv) continue; } - if (cmd != NULL) + if (cmd != NULL && cb.cb_verbose) cb.vcdl = all_pools_for_each_vdev_run(argc, - argv, cmd); + argv, cmd, g_zfs, cb.cb_vdev_names, + cb.cb_vdev_names_count, cb.cb_name_flags); pool_list_iter(list, B_FALSE, print_iostat, &cb); @@ -6113,8 +6119,13 @@ zpool_do_status(int argc, char **argv) get_timestamp_arg(*optarg); break; case '?': - (void) fprintf(stderr, gettext("invalid option '%c'\n"), - optopt); + if (optopt == 'c') { + fprintf(stderr, + gettext("Missing CMD for -c\n")); + } else { + fprintf(stderr, + gettext("invalid option '%c'\n"), optopt); + } usage(B_FALSE); } } @@ -6135,7 +6146,8 @@ zpool_do_status(int argc, char **argv) print_timestamp(timestamp_fmt); if (cmd != NULL) - cb.vcdl = all_pools_for_each_vdev_run(argc, argv, cmd); + cb.vcdl = all_pools_for_each_vdev_run(argc, argv, cmd, + NULL, NULL, 0, 0); ret = for_each_pool(argc, argv, B_TRUE, NULL, status_callback, &cb); |