Revision 4e679f11
b/daemons/ganeti-noded | ||
---|---|---|
451 | 451 |
"""Query detailed information about existing OSes. |
452 | 452 |
|
453 | 453 |
""" |
454 |
os_list = backend.DiagnoseOS() |
|
455 |
if not os_list: |
|
456 |
# this catches also return values of 'False', |
|
457 |
# for which we can't iterate over |
|
458 |
return os_list |
|
459 |
result = [] |
|
460 |
for data in os_list: |
|
461 |
if isinstance(data, objects.OS): |
|
462 |
result.append(data.ToDict()) |
|
463 |
elif isinstance(data, errors.InvalidOS): |
|
464 |
result.append(data.args) |
|
465 |
else: |
|
466 |
raise errors.ProgrammerError("Invalid result from backend.DiagnoseOS" |
|
467 |
" (class %s, %s)" % |
|
468 |
(str(data.__class__), data)) |
|
469 |
|
|
470 |
return result |
|
454 |
return [os.ToDict() for os in backend.DiagnoseOS()] |
|
471 | 455 |
|
472 | 456 |
@staticmethod |
473 | 457 |
def perspective_os_get(params): |
b/lib/rpc.py | ||
---|---|---|
638 | 638 |
result = c.getresult() |
639 | 639 |
new_result = {} |
640 | 640 |
for node_name in result: |
641 |
nr = [] |
|
642 | 641 |
if result[node_name]: |
643 |
for data in result[node_name]: |
|
644 |
if data: |
|
645 |
if isinstance(data, dict): |
|
646 |
nr.append(objects.OS.FromDict(data)) |
|
647 |
elif isinstance(data, tuple) and len(data) == 3: |
|
648 |
nr.append(errors.InvalidOS(data[0], data[1], data[2])) |
|
649 |
else: |
|
650 |
raise errors.ProgrammerError("Invalid data from" |
|
651 |
" xcserver.os_diagnose") |
|
642 |
nr = [objects.OS.FromDict(oss) for oss in result[node_name]] |
|
643 |
else: |
|
644 |
nr = [] |
|
652 | 645 |
new_result[node_name] = nr |
653 | 646 |
return new_result |
654 | 647 |
|
Also available in: Unified diff