JSON output support for zpool get

This commit adds support for zpool get command to output the list of
properties for ZFS Pools and VDEVS in JSON format using '-j' option.
Man page for zpool get is updated to include '-j' option.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Signed-off-by: Umer Saleem <usaleem@ixsystems.com>
Closes #16217
This commit is contained in:
Umer Saleem
2024-04-24 19:58:17 +05:00
committed by Brian Behlendorf
parent 5cbdd5ea4f
commit eb2b824bde
5 changed files with 287 additions and 62 deletions
+5
View File
@@ -666,6 +666,7 @@ typedef struct zprop_get_cbdata {
vdev_cbdata_t cb_vdevs;
nvlist_t *cb_jsobj;
boolean_t cb_json_as_int;
boolean_t cb_json_pool_key_guid;
} zprop_get_cbdata_t;
#define ZFS_SET_NOMOUNT 1
@@ -682,6 +683,10 @@ _LIBZFS_H void zprop_print_one_property(const char *, zprop_get_cbdata_t *,
_LIBZFS_H int zprop_nvlist_one_property(const char *, const char *,
zprop_source_t, const char *, const char *, nvlist_t *, boolean_t);
_LIBZFS_H int zprop_collect_property(const char *, zprop_get_cbdata_t *,
const char *, const char *, zprop_source_t, const char *,
const char *, nvlist_t *);
/*
* Iterator functions.
*/