Commit ae5b1530 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add a new gnt-os info command

This can be used to show the actual OS parameters and supported
variants, in a global manner (rather than per-node as gnt-os diagnose).
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarGuido Trotter <>
parent bad78e66
......@@ -82,6 +82,17 @@
of all the OSes and the reasons they are or are not valid.
This command will list detailed information about each OS
available in the cluster, including its validity status, the
supported API versions, the supported parameters (if any) and
their documentations, etc.
<arg>-H <replaceable>HYPERVISOR</replaceable><arg>:<arg choice="plain" rep="repeat">option=<replaceable>value</replaceable></arg></arg></arg>
......@@ -70,6 +70,55 @@ def ListOS(opts, args):
return 0
def ShowOSInfo(opts, args):
"""List detailed information about OSes in the cluster.
@param opts: the command line options selected by the user
@type args: list
@param args: should be an empty list
@rtype: int
@return: the desired exit code
op = opcodes.OpDiagnoseOS(output_fields=["name", "valid", "variants",
"parameters", "api_versions"],
result = SubmitOpCode(op, opts=opts)
if not result:
ToStderr("Can't get the OS list")
return 1
do_filter = bool(args)
for (name, valid, variants, parameters, api_versions) in result:
if do_filter:
if name not in args:
ToStdout("%s:", name)
ToStdout(" - valid: %s", valid)
if valid:
ToStdout(" - API versions:")
for version in sorted(api_versions):
ToStdout(" - %s", version)
ToStdout(" - variants:")
for vname in variants:
ToStdout(" - %s", vname)
ToStdout(" - parameters:")
for pname, pdesc in parameters:
ToStdout(" - %s: %s", pname, pdesc)
if args:
for name in args:
ToStdout("%s: ", name)
return 0
def _OsStatus(status, diagnose):
"""Beautifier function for OS status.
......@@ -203,6 +252,9 @@ commands = {
" on the cluster"),
'diagnose': (
DiagnoseOS, ARGS_NONE, [], "", "Diagnose all operating systems"),
'info': (
ShowOSInfo, [ArgOs()], [], "", "Show detailed information about "
"operating systems"),
'modify': (
"Modify the OS parameters"),
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