Skip to content

Commit

Permalink
zpool status -k shows kind of vdevs: ssd, hdd or mixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
inkdot7 committed Dec 14, 2016
1 parent 9325372 commit 044579a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
20 changes: 15 additions & 5 deletions cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ 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] ... "
return (gettext("\tstatus [-gkLPvxD] [-T d|u] [pool] ... "
"[interval [count]]\n"));
case HELP_UPGRADE:
return (gettext("\tupgrade\n"
Expand Down Expand Up @@ -1538,6 +1538,7 @@ typedef struct status_cbdata {
boolean_t cb_explain;
boolean_t cb_first;
boolean_t cb_dedup_stats;
boolean_t cb_kind;
boolean_t cb_print_status;
vdev_cmd_data_list_t *vcdl;
} status_cbdata_t;
Expand Down Expand Up @@ -1601,8 +1602,13 @@ print_status_config(zpool_handle_t *zhp, status_cbdata_t *cb, const char *name,
zfs_nicenum(vs->vs_write_errors, wbuf, sizeof (wbuf));
zfs_nicenum(vs->vs_checksum_errors, cbuf, sizeof (cbuf));
(void) printf(" %5s %5s %5s", rbuf, wbuf, cbuf);
} else {
(void) printf(" ");
}

if (cb->cb_kind)
(void) printf(" %4s", kind_mark(nv));

if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT,
&notpresent) == 0) {
verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0);
Expand Down Expand Up @@ -6042,9 +6048,9 @@ status_callback(zpool_handle_t *zhp, void *data)
cbp->cb_namewidth = 10;

(void) printf(gettext("config:\n\n"));
(void) printf(gettext("\t%-*s %-8s %5s %5s %5s\n"),
(void) printf(gettext("\t%-*s %-8s %5s %5s %5s%s\n"),
cbp->cb_namewidth, "NAME", "STATE", "READ", "WRITE",
"CKSUM");
"CKSUM", cbp->cb_kind ? " KIND" : "");
print_status_config(zhp, cbp, zpool_get_name(zhp), nvroot, 0,
B_FALSE);

Expand Down Expand Up @@ -6104,10 +6110,11 @@ status_callback(zpool_handle_t *zhp, void *data)
}

/*
* zpool status [-c CMD] [-gLPvx] [-T d|u] [pool] ... [interval [count]]
* zpool status [-c CMD] [-gkLPvx] [-T d|u] [pool] ... [interval [count]]
*
* -c CMD For each vdev, run command CMD
* -g Display guid for individual vdev name.
* -k Display kind of device, e.g. solid-state or mixed.
* -L Follow links when resolving vdev path name.
* -P Display full path for vdev name.
* -v Display complete error logs
Expand All @@ -6128,14 +6135,17 @@ zpool_do_status(int argc, char **argv)
char *cmd = NULL;

/* check options */
while ((c = getopt(argc, argv, "c:gLPvxDT:")) != -1) {
while ((c = getopt(argc, argv, "c:gkLPvxDT:")) != -1) {
switch (c) {
case 'c':
cmd = optarg;
break;
case 'g':
cb.cb_name_flags |= VDEV_NAME_GUID;
break;
case 'k':
cb.cb_kind = B_TRUE;
break;
case 'L':
cb.cb_name_flags |= VDEV_NAME_FOLLOW_LINKS;
break;
Expand Down
13 changes: 11 additions & 2 deletions man/man8/zpool.8
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ zpool \- configures ZFS storage pools

.LP
.nf
\fBzpool status\fR [\fB-c\fR \fBCMD\fR] [\fB-gLPvxD\fR] [\fB-T\fR d | u] [\fIpool\fR] ... [\fIinterval\fR [\fIcount\fR]]
\fBzpool status\fR [\fB-c\fR \fBCMD\fR] [\fB-gkLPvxD\fR] [\fB-T\fR d | u] [\fIpool\fR] ... [\fIinterval\fR [\fIcount\fR]]
.fi

.LP
Expand Down Expand Up @@ -2108,7 +2108,7 @@ Sets the specified property for \fInewpool\fR. See the “Properties” section
.sp
.ne 2
.na
\fBzpool status\fR [\fB-c\fR \fBCMD\fR] [\fB-gLPvxD\fR] [\fB-T\fR d | u] [\fIpool\fR] ... [\fIinterval\fR [\fIcount\fR]]
\fBzpool status\fR [\fB-c\fR \fBCMD\fR] [\fB-gkLPvxD\fR] [\fB-T\fR d | u] [\fIpool\fR] ... [\fIinterval\fR [\fIcount\fR]]
.ad
.sp .6
.RS 4n
Expand Down Expand Up @@ -2142,6 +2142,15 @@ in parallel for each vdev for performance.
Display vdev GUIDs instead of the normal device names. These GUIDs can be used innplace of device names for the zpool detach/offline/remove/replace commands.
.RE

.sp
.ne 2
.na
\fB\fB-k\fR\fR
.ad
.RS 12n
Display the kind of device a pool or vdev is based on: ssd, hdd or file. Mixed mirror vdevs that have both ssd (or file) and hdd members are marked "mix". A pool is considered mixed if all members are at least mixed, i.e. no pure hdd.
.RE

.sp
.ne 2
.na
Expand Down

0 comments on commit 044579a

Please sign in to comment.