Revision 255dcebd scripts/gnt-os
b/scripts/gnt-os | ||
---|---|---|
64 | 64 |
return 0 |
65 | 65 |
|
66 | 66 |
|
67 |
def _OsStatus(status, diagnose): |
|
68 |
"""Beautifier function for OS status. |
|
69 |
|
|
70 |
@type status: boolean |
|
71 |
@param status: is the OS valid |
|
72 |
@type diagnose: string |
|
73 |
@param diagnose: the error message for invalid OSes |
|
74 |
@rtype: string |
|
75 |
@return: a formatted status |
|
76 |
|
|
77 |
""" |
|
78 |
if status: |
|
79 |
return "valid" |
|
80 |
else: |
|
81 |
return "invalid - %s" % diagnose |
|
82 |
|
|
67 | 83 |
def DiagnoseOS(opts, args): |
68 | 84 |
"""Analyse all OSes on this cluster. |
69 | 85 |
|
... | ... | |
91 | 107 |
for node_name, node_info in node_data.iteritems(): |
92 | 108 |
nodes_hidden[node_name] = [] |
93 | 109 |
if node_info: # at least one entry in the per-node list |
94 |
first_os_status, first_os_path = node_info.pop(0) |
|
95 |
first_os_msg = ("%s (path: %s)" % |
|
96 |
(first_os_status, first_os_path)) |
|
97 |
if first_os_status == constants.OS_VALID_STATUS: |
|
110 |
first_os_path, first_os_status, first_os_msg = node_info.pop(0) |
|
111 |
first_os_msg = ("%s (path: %s)" % (_OsStatus(first_os_status, |
|
112 |
first_os_msg), |
|
113 |
first_os_path)) |
|
114 |
if first_os_status: |
|
98 | 115 |
nodes_valid[node_name] = first_os_msg |
99 | 116 |
else: |
100 | 117 |
nodes_bad[node_name] = first_os_msg |
101 |
for hstatus, hpath in node_info:
|
|
118 |
for hpath, hstatus, hmsg in node_info:
|
|
102 | 119 |
nodes_hidden[node_name].append(" [hidden] path: %s, status: %s" % |
103 |
(hpath, hstatus))
|
|
120 |
(hpath, _OsStatus(hstatus, hmsg)))
|
|
104 | 121 |
else: |
105 | 122 |
nodes_bad[node_name] = "OS not found" |
106 | 123 |
|
Also available in: Unified diff