Commit 852bbc95 authored by Balazs Lecz's avatar Balazs Lecz
Browse files

Add printing of uid_pool to gnt-cluster info


Signed-off-by: default avatarBalazs Lecz <leczb@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent fdad8c4d
......@@ -31,6 +31,7 @@ from the pool.
from ganeti import errors
from ganeti import constants
from ganeti import utils
def ParseUidPool(value, separator=None):
......@@ -108,6 +109,28 @@ def RemoveFromUidPool(uid_pool, remove_uids):
uid_pool.remove(uid_range)
def _FormatUidRange(lower, higher):
"""Convert a user-id range definition into a string.
"""
if lower == higher:
return str(lower)
return "%s-%s" % (lower, higher)
def FormatUidPool(uid_pool):
"""Convert the internal representation of the user-id pool into a string.
The output format is also accepted by ParseUidPool()
@param uid_pool: a list of integer pairs representing UID ranges
@return: a string with the formatted results
"""
return utils.CommaJoin([_FormatUidRange(lower, higher)
for lower, higher in uid_pool])
def CheckUidPool(uid_pool):
"""Sanity check user-id pool range definition values.
......
......@@ -276,6 +276,7 @@ def ShowClusterConfig(opts, args):
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("Default instance parameters:")
_PrintGroupedParams(result["beparams"])
......
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