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 <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent bad78e66
......@@ -82,6 +82,17 @@
of all the OSes and the reasons they are or are not valid.
</para>
<cmdsynopsis>
<command>info</command>
</cmdsynopsis>
<para>
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.
</para>
<cmdsynopsis>
<command>modify</command>
<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"],
names=[])
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:
continue
else:
args.remove(name)
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)
ToStdout("")
if args:
for name in args:
ToStdout("%s: ", name)
ToStdout("")
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': (
ModifyOS, ARGS_ONE_OS, [HVLIST_OPT, OSPARAMS_OPT], "",
"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