Skip to content
Snippets Groups Projects
Commit ccadf1ff authored by Iustin Pop's avatar Iustin Pop
Browse files

Simplify gnt-os diagnose output


Currently, we always list the api/variants, even if these are empty.
This patch changes so that we make clear distiction for empty values
("[no variants]" versus "[variants: ]"), and we only list variants and
parameters when the OS API indicates they should be supported.

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent ae5b1530
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,7 @@
import sys
from ganeti.cli import *
from ganeti import constants
from ganeti import opcodes
from ganeti import utils
......@@ -162,18 +163,30 @@ def DiagnoseOS(opts, args):
for node_name, node_info in node_data.iteritems():
nodes_hidden[node_name] = []
if node_info: # at least one entry in the per-node list
(first_os_path, first_os_status, first_os_msg,
first_os_variants, _, first_os_api) = node_info.pop(0)
if not first_os_variants:
first_os_variants = []
first_os_msg = ("%s (path: %s) [variants: %s] [api: %s]" %
(_OsStatus(first_os_status, first_os_msg),
first_os_path, utils.CommaJoin(first_os_variants),
utils.CommaJoin(first_os_api)))
if first_os_status:
nodes_valid[node_name] = first_os_msg
(fo_path, fo_status, fo_msg, fo_variants,
fo_params, fo_api) = node_info.pop(0)
fo_msg = "%s (path: %s)" % (_OsStatus(fo_status, fo_msg), fo_path)
if fo_api:
max_os_api = max(fo_api)
fo_msg += " [API versions: %s]" % utils.CommaJoin(fo_api)
else:
nodes_bad[node_name] = first_os_msg
max_os_api = 0
fo_msg += " [no API versions declared]"
if max_os_api >= constants.OS_API_V15:
if fo_variants:
fo_msg += " [variants: %s]" % utils.CommaJoin(fo_variants)
else:
fo_msg += " [no variants]"
if max_os_api >= constants.OS_API_V20:
if fo_params:
fo_msg += (" [parameters: %s]" %
utils.CommaJoin([v[0] for v in fo_params]))
else:
fo_msg += " [no parameters]"
if fo_status:
nodes_valid[node_name] = fo_msg
else:
nodes_bad[node_name] = fo_msg
for hpath, hstatus, hmsg, _, _, _ in node_info:
nodes_hidden[node_name].append(" [hidden] path: %s, status: %s" %
(hpath, _OsStatus(hstatus, hmsg)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment