diff options
author | Tim Chase <[email protected]> | 2013-10-22 16:51:17 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-02-11 14:05:17 -0800 |
commit | e02b533e746403743297020591e4b80d614a3aae (patch) | |
tree | 1ef0d72ce3ca6f223afe8d4aa686ed84038d05bb | |
parent | 340dfbe193193be6a3d301d8111de232cd537ddd (diff) |
Enhancements to zpool dry run mode.
In dry run mode, zpool should display more of the proposed pool
configuration for "zpool add". This commit adds support for displaying
cache devices.
Signed-off-by: Tim Chase <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue #1106
-rw-r--r-- | cmd/zpool/zpool_main.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index 0f2bab6e9..9e37eb228 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -593,6 +593,10 @@ zpool_do_add(int argc, char **argv) if (dryrun) { nvlist_t *poolnvroot; + nvlist_t **l2child; + uint_t l2children, c; + char *vname; + boolean_t hadcache = B_FALSE; verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &poolnvroot) == 0); @@ -612,6 +616,30 @@ zpool_do_add(int argc, char **argv) print_vdev_tree(zhp, "logs", nvroot, 0, B_TRUE); } + /* Do the same for the caches */ + if (nvlist_lookup_nvlist_array(poolnvroot, ZPOOL_CONFIG_L2CACHE, + &l2child, &l2children) == 0 && l2children) { + hadcache = B_TRUE; + (void) printf(gettext("\tcache\n")); + for (c = 0; c < l2children; c++) { + vname = zpool_vdev_name(g_zfs, NULL, + l2child[c], B_FALSE); + (void) printf("\t %s\n", vname); + free(vname); + } + } + if (nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_L2CACHE, + &l2child, &l2children) == 0 && l2children) { + if (!hadcache) + (void) printf(gettext("\tcache\n")); + for (c = 0; c < l2children; c++) { + vname = zpool_vdev_name(g_zfs, NULL, + l2child[c], B_FALSE); + (void) printf("\t %s\n", vname); + free(vname); + } + } + ret = 0; } else { ret = (zpool_add(zhp, nvroot) != 0); |