Skip to content

Commit 3a0a142

Browse files
Umer Saleembehlendorf
authored andcommitted
JSON: fix user properties output for zpool list
This commit fixes JSON output for zpool list when user properties are requested with -o flag. This case needed to be handled specifically since zpool_prop_to_name does not return property name for user properties, instead it is stored in pl->pl_user_prop. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Umer Saleem <usaleem@ixsystems.com> Closes openzfs#16734
1 parent 57fc597 commit 3a0a142

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmd/zpool/zpool_main.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6882,8 +6882,13 @@ collect_pool(zpool_handle_t *zhp, list_cbdata_t *cb)
68826882
if (cb->cb_json) {
68836883
if (pl->pl_prop == ZPOOL_PROP_NAME)
68846884
continue;
6885+
const char *prop_name;
6886+
if (pl->pl_prop != ZPROP_USERPROP)
6887+
prop_name = zpool_prop_to_name(pl->pl_prop);
6888+
else
6889+
prop_name = pl->pl_user_prop;
68856890
(void) zprop_nvlist_one_property(
6886-
zpool_prop_to_name(pl->pl_prop), propstr,
6891+
prop_name, propstr,
68876892
sourcetype, NULL, NULL, props, cb->cb_json_as_int);
68886893
} else {
68896894
/*

0 commit comments

Comments
 (0)