Commit d729e03a authored by Guido Trotter's avatar Guido Trotter
Browse files

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: default avatarGuido Trotter <>
Reviewed-by: default avatarIustin Pop <>
parent 196ec587
......@@ -202,12 +202,20 @@
Shows runtime cluster information: cluster name, architecture
(32 or 64 bit), master node, node list and instance list.
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.
......@@ -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))
ToStdout("%s %s: %s", indent, item, val)
......@@ -276,19 +278,23 @@ def ShowClusterConfig(opts, args):
ToStdout("Cluster parameters:")
ToStdout(" - candidate pool size: %s", result["candidate_pool_size"])
ToStdout(" - candidate pool size: %s",
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",
ToStdout(" - uid pool: %s", uidpool.FormatUidPool(result["uid_pool"]))
ToStdout(" - uid pool: %s",
ToStdout("Default instance parameters:")
_PrintGroupedParams(result["beparams"], roman=opts.roman_integers)
ToStdout("Default nic parameters:")
_PrintGroupedParams(result["nicparams"], roman=opts.roman_integers)
return 0
......@@ -789,8 +795,8 @@ commands = {
"[-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': (
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment