Revision d22dfef7
b/lib/cmdlib.py | ||
---|---|---|
3122 | 3122 |
REQ_BGL = False |
3123 | 3123 |
_HID = "hidden" |
3124 | 3124 |
_BLK = "blacklisted" |
3125 |
_VLD = "valid" |
|
3125 | 3126 |
_FIELDS_STATIC = utils.FieldSet() |
3126 |
_FIELDS_DYNAMIC = utils.FieldSet("name", "valid", "node_status", "variants",
|
|
3127 |
_FIELDS_DYNAMIC = utils.FieldSet("name", _VLD, "node_status", "variants",
|
|
3127 | 3128 |
"parameters", "api_versions", _HID, _BLK) |
3128 | 3129 |
|
3129 | 3130 |
def CheckArguments(self): |
... | ... | |
3215 | 3216 |
is_hid = os_name in cluster.hidden_oss |
3216 | 3217 |
is_blk = os_name in cluster.blacklisted_oss |
3217 | 3218 |
if ((self._HID not in self.op.output_fields and is_hid) or |
3218 |
(self._BLK not in self.op.output_fields and is_blk)): |
|
3219 |
(self._BLK not in self.op.output_fields and is_blk) or |
|
3220 |
(self._VLD not in self.op.output_fields and not valid)): |
|
3219 | 3221 |
continue |
3220 | 3222 |
|
3221 | 3223 |
for field in self.op.output_fields: |
3222 | 3224 |
if field == "name": |
3223 | 3225 |
val = os_name |
3224 |
elif field == "valid":
|
|
3226 |
elif field == self._VLD:
|
|
3225 | 3227 |
val = valid |
3226 | 3228 |
elif field == "node_status": |
3227 | 3229 |
# this is just a copy of the dict |
b/lib/rapi/rlib2.py | ||
---|---|---|
148 | 148 |
|
149 | 149 |
""" |
150 | 150 |
cl = baserlib.GetClient() |
151 |
op = opcodes.OpDiagnoseOS(output_fields=["name", "valid", "variants"], |
|
152 |
names=[]) |
|
151 |
op = opcodes.OpDiagnoseOS(output_fields=["name", "variants"], names=[]) |
|
153 | 152 |
job_id = baserlib.SubmitJob([op], cl) |
154 | 153 |
# we use custom feedback function, instead of print we log the status |
155 | 154 |
result = cli.PollJob(job_id, cl, feedback_fn=baserlib.FeedbackFn) |
... | ... | |
159 | 158 |
raise http.HttpBadGateway(message="Can't get OS list") |
160 | 159 |
|
161 | 160 |
os_names = [] |
162 |
for (name, valid, variants) in diagnose_data: |
|
163 |
if valid: |
|
164 |
os_names.extend(cli.CalculateOSNames(name, variants)) |
|
161 |
for (name, variants) in diagnose_data: |
|
162 |
os_names.extend(cli.CalculateOSNames(name, variants)) |
|
165 | 163 |
|
166 | 164 |
return os_names |
167 | 165 |
|
b/scripts/gnt-instance | ||
---|---|---|
524 | 524 |
|
525 | 525 |
# second, if requested, ask for an OS |
526 | 526 |
if opts.select_os is True: |
527 |
op = opcodes.OpDiagnoseOS(output_fields=["name", "valid", "variants"], |
|
528 |
names=[]) |
|
527 |
op = opcodes.OpDiagnoseOS(output_fields=["name", "variants"], names=[]) |
|
529 | 528 |
result = SubmitOpCode(op, opts=opts) |
530 | 529 |
|
531 | 530 |
if not result: |
... | ... | |
535 | 534 |
ToStdout("Available OS templates:") |
536 | 535 |
number = 0 |
537 | 536 |
choices = [] |
538 |
for (name, valid, variants) in result: |
|
539 |
if valid: |
|
540 |
for entry in CalculateOSNames(name, variants): |
|
541 |
ToStdout("%3s: %s", number, entry) |
|
542 |
choices.append(("%s" % number, entry, entry)) |
|
543 |
number += 1 |
|
537 |
for (name, variants) in result: |
|
538 |
for entry in CalculateOSNames(name, variants): |
|
539 |
ToStdout("%3s: %s", number, entry) |
|
540 |
choices.append(("%s" % number, entry, entry)) |
|
541 |
number += 1 |
|
544 | 542 |
|
545 | 543 |
choices.append(('x', 'exit', 'Exit gnt-instance reinstall')) |
546 | 544 |
selected = AskUser("Enter OS template number (or x to abort):", |
b/scripts/gnt-os | ||
---|---|---|
44 | 44 |
@return: the desired exit code |
45 | 45 |
|
46 | 46 |
""" |
47 |
op = opcodes.OpDiagnoseOS(output_fields=["name", "valid", "variants"], |
|
48 |
names=[]) |
|
47 |
op = opcodes.OpDiagnoseOS(output_fields=["name", "variants"], names=[]) |
|
49 | 48 |
result = SubmitOpCode(op, opts=opts) |
50 | 49 |
|
51 | 50 |
if not result: |
... | ... | |
58 | 57 |
headers = None |
59 | 58 |
|
60 | 59 |
os_names = [] |
61 |
for (name, valid, variants) in result: |
|
62 |
if valid: |
|
63 |
os_names.extend([[n] for n in CalculateOSNames(name, variants)]) |
|
60 |
for (name, variants) in result: |
|
61 |
os_names.extend([[n] for n in CalculateOSNames(name, variants)]) |
|
64 | 62 |
|
65 | 63 |
data = GenerateTable(separator=None, headers=headers, fields=["name"], |
66 | 64 |
data=os_names, units=None) |
b/tools/burnin | ||
---|---|---|
510 | 510 |
Err(msg, exit_code=err_code) |
511 | 511 |
self.nodes = [data[0] for data in result if not (data[1] or data[2])] |
512 | 512 |
|
513 |
op_diagnose = opcodes.OpDiagnoseOS(output_fields=["name", "valid",
|
|
514 |
"variants"], names=[])
|
|
513 |
op_diagnose = opcodes.OpDiagnoseOS(output_fields=["name", "variants"],
|
|
514 |
names=[]) |
|
515 | 515 |
result = self.ExecOp(True, op_diagnose) |
516 | 516 |
|
517 | 517 |
if not result: |
518 | 518 |
Err("Can't get the OS list") |
519 | 519 |
|
520 | 520 |
found = False |
521 |
for (name, valid, variants) in result:
|
|
522 |
if valid and self.opts.os in cli.CalculateOSNames(name, variants):
|
|
521 |
for (name, variants) in result: |
|
522 |
if self.opts.os in cli.CalculateOSNames(name, variants): |
|
523 | 523 |
found = True |
524 | 524 |
break |
525 | 525 |
|
Also available in: Unified diff