diff --git a/lib/backend.py b/lib/backend.py index bab6f0dc902af7af4ec8aded67ae03a35b725257..edbbc4807b02dbf56dfd9e5d4f3fd790c55e0c23 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -1633,12 +1633,13 @@ def DiagnoseOS(top_dirs=None): search (if not given defaults to L{constants.OS_SEARCH_PATH}) @rtype: list of L{objects.OS} - @return: a list of tuples (name, path, status, diagnose) + @return: a list of tuples (name, path, status, diagnose, variants) for all (potential) OSes under all search paths, where: - name is the (potential) OS name - path is the full path to the OS - status True/False is the validity of the OS - diagnose is the error message for an invalid OS, otherwise empty + - variants is a list of supported OS variants, if any """ if top_dirs is None: @@ -1657,9 +1658,11 @@ def DiagnoseOS(top_dirs=None): status, os_inst = _TryOSFromDisk(name, base_dir=dir_name) if status: diagnose = "" + variants = os_inst.supported_variants else: diagnose = os_inst - result.append((name, os_path, status, diagnose)) + variants = [] + result.append((name, os_path, status, diagnose, variants)) return result diff --git a/lib/cmdlib.py b/lib/cmdlib.py index c7e1ec1616ede28ade17228675f13bc39484f89c..e8c4d8c36f94888d3040152ccca5b5b27e468bdb 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -2193,14 +2193,14 @@ class LUDiagnoseOS(NoHooksLU): for node_name, nr in rlist.items(): if nr.fail_msg or not nr.payload: continue - for name, path, status, diagnose in nr.payload: + for name, path, status, diagnose, variants in nr.payload: if name not in all_os: # build a list of nodes for this os containing empty lists # for each node in node_list all_os[name] = {} for nname in good_nodes: all_os[name][nname] = [] - all_os[name][node_name].append((path, status, diagnose)) + all_os[name][node_name].append((path, status, diagnose, variants)) return all_os def Exec(self, feedback_fn): diff --git a/scripts/gnt-os b/scripts/gnt-os index df68165b16d786558b849045da3977ccca8ac55a..1aacfacd25c28f33b62af86b1c9f819191b56847 100755 --- a/scripts/gnt-os +++ b/scripts/gnt-os @@ -106,10 +106,13 @@ 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 = node_info.pop(0) - first_os_msg = ("%s (path: %s)" % (_OsStatus(first_os_status, - first_os_msg), - first_os_path)) + (first_os_path, first_os_status, first_os_msg, + first_os_variants) = node_info.pop(0) + if not first_os_variants: + first_os_variants = [] + first_os_msg = ("%s (path: %s) [variants: %s]" % + (_OsStatus(first_os_status, first_os_msg), + first_os_path, ', '.join(first_os_variants))) if first_os_status: nodes_valid[node_name] = first_os_msg else: