70 |
70 |
return 0
|
71 |
71 |
|
72 |
72 |
|
|
73 |
def ShowOSInfo(opts, args):
|
|
74 |
"""List detailed information about OSes in the cluster.
|
|
75 |
|
|
76 |
@param opts: the command line options selected by the user
|
|
77 |
@type args: list
|
|
78 |
@param args: should be an empty list
|
|
79 |
@rtype: int
|
|
80 |
@return: the desired exit code
|
|
81 |
|
|
82 |
"""
|
|
83 |
op = opcodes.OpDiagnoseOS(output_fields=["name", "valid", "variants",
|
|
84 |
"parameters", "api_versions"],
|
|
85 |
names=[])
|
|
86 |
result = SubmitOpCode(op, opts=opts)
|
|
87 |
|
|
88 |
if not result:
|
|
89 |
ToStderr("Can't get the OS list")
|
|
90 |
return 1
|
|
91 |
|
|
92 |
do_filter = bool(args)
|
|
93 |
|
|
94 |
for (name, valid, variants, parameters, api_versions) in result:
|
|
95 |
if do_filter:
|
|
96 |
if name not in args:
|
|
97 |
continue
|
|
98 |
else:
|
|
99 |
args.remove(name)
|
|
100 |
ToStdout("%s:", name)
|
|
101 |
ToStdout(" - valid: %s", valid)
|
|
102 |
if valid:
|
|
103 |
ToStdout(" - API versions:")
|
|
104 |
for version in sorted(api_versions):
|
|
105 |
ToStdout(" - %s", version)
|
|
106 |
ToStdout(" - variants:")
|
|
107 |
for vname in variants:
|
|
108 |
ToStdout(" - %s", vname)
|
|
109 |
ToStdout(" - parameters:")
|
|
110 |
for pname, pdesc in parameters:
|
|
111 |
ToStdout(" - %s: %s", pname, pdesc)
|
|
112 |
ToStdout("")
|
|
113 |
|
|
114 |
if args:
|
|
115 |
for name in args:
|
|
116 |
ToStdout("%s: ", name)
|
|
117 |
ToStdout("")
|
|
118 |
|
|
119 |
return 0
|
|
120 |
|
|
121 |
|
73 |
122 |
def _OsStatus(status, diagnose):
|
74 |
123 |
"""Beautifier function for OS status.
|
75 |
124 |
|
... | ... | |
203 |
252 |
" on the cluster"),
|
204 |
253 |
'diagnose': (
|
205 |
254 |
DiagnoseOS, ARGS_NONE, [], "", "Diagnose all operating systems"),
|
|
255 |
'info': (
|
|
256 |
ShowOSInfo, [ArgOs()], [], "", "Show detailed information about "
|
|
257 |
"operating systems"),
|
206 |
258 |
'modify': (
|
207 |
259 |
ModifyOS, ARGS_ONE_OS, [HVLIST_OPT, OSPARAMS_OPT], "",
|
208 |
260 |
"Modify the OS parameters"),
|