From d729e03aeac7ac0df4b3d2743d10ad2f6e09b667 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Thu, 27 May 2010 11:28:04 +0100 Subject: [PATCH] gnt-cluster info --roman Convert to roman (if so the user wishes) the following: - cluster candidate size - uid pool - any integer be or hv parameter Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- man/gnt-cluster.sgml | 8 ++++++++ scripts/gnt-cluster | 22 ++++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/man/gnt-cluster.sgml b/man/gnt-cluster.sgml index 13f4f7bb6..8b268ab8e 100644 --- a/man/gnt-cluster.sgml +++ b/man/gnt-cluster.sgml @@ -202,12 +202,20 @@ <cmdsynopsis> <command>info</command> + <arg>--roman</arg> </cmdsynopsis> <para> Shows runtime cluster information: cluster name, architecture (32 or 64 bit), master node, node list and instance list. </para> + + <para> + Passing the <option>--roman</option> option gnt-cluster info will try + to print its integer fields in a latin friendly way. This allows + further diffusion of Ganeti among ancient cultures. + </para> + </refsect2> <refsect2> diff --git a/scripts/gnt-cluster b/scripts/gnt-cluster index a215618f0..d07e5b553 100755 --- a/scripts/gnt-cluster +++ b/scripts/gnt-cluster @@ -216,7 +216,7 @@ def ShowClusterMaster(opts, args): return 0 -def _PrintGroupedParams(paramsdict, level=1): +def _PrintGroupedParams(paramsdict, level=1, roman=False): """Print Grouped parameters (be, nic, disk) by group. @type paramsdict: dict of dicts @@ -229,7 +229,9 @@ def _PrintGroupedParams(paramsdict, level=1): for item, val in sorted(paramsdict.items()): if isinstance(val, dict): ToStdout("%s- %s:", indent, item) - _PrintGroupedParams(val, level=level + 1) + _PrintGroupedParams(val, level=level + 1, roman=roman) + elif roman and isinstance(val, int): + ToStdout("%s %s: %s", indent, item, compat.TryToRoman(val)) else: ToStdout("%s %s: %s", indent, item, val) @@ -276,19 +278,23 @@ def ShowClusterConfig(opts, args): _PrintGroupedParams(result["os_hvp"]) ToStdout("Cluster parameters:") - ToStdout(" - candidate pool size: %s", result["candidate_pool_size"]) + ToStdout(" - candidate pool size: %s", + compat.TryToRoman(result["candidate_pool_size"], + convert=opts.roman_integers)) ToStdout(" - master netdev: %s", result["master_netdev"]) ToStdout(" - lvm volume group: %s", result["volume_group_name"]) ToStdout(" - file storage path: %s", result["file_storage_dir"]) ToStdout(" - maintenance of node health: %s", result["maintain_node_health"]) - ToStdout(" - uid pool: %s", uidpool.FormatUidPool(result["uid_pool"])) + ToStdout(" - uid pool: %s", + uidpool.FormatUidPool(result["uid_pool"], + roman=opts.roman_integers)) ToStdout("Default instance parameters:") - _PrintGroupedParams(result["beparams"]) + _PrintGroupedParams(result["beparams"], roman=opts.roman_integers) ToStdout("Default nic parameters:") - _PrintGroupedParams(result["nicparams"]) + _PrintGroupedParams(result["nicparams"], roman=opts.roman_integers) return 0 @@ -789,8 +795,8 @@ commands = { [NODE_LIST_OPT], "[-n node...] <command>", "Runs a command on all (or only some) nodes"), 'info': ( - ShowClusterConfig, ARGS_NONE, [], - "", "Show cluster configuration"), + ShowClusterConfig, ARGS_NONE, [ROMAN_OPT], + "[--roman]", "Show cluster configuration"), 'list-tags': ( ListTags, ARGS_NONE, [], "", "List the tags of the cluster"), 'add-tags': ( -- GitLab