Revision ae1a845c lib/client/gnt_cluster.py
b/lib/client/gnt_cluster.py | ||
---|---|---|
503 | 503 |
cl = GetClient() |
504 | 504 |
|
505 | 505 |
op = opcodes.OpClusterVerifyDisks() |
506 |
result = SubmitOpCode(op, opts=opts, cl=cl) |
|
507 |
if not isinstance(result, (list, tuple)) or len(result) != 3: |
|
508 |
raise errors.ProgrammerError("Unknown result type for OpClusterVerifyDisks") |
|
509 | 506 |
|
510 |
bad_nodes, instances, missing = result |
|
507 |
result = SubmitOpCode(op, cl=cl, opts=opts) |
|
508 |
|
|
509 |
# Keep track of submitted jobs |
|
510 |
jex = JobExecutor(cl=cl, opts=opts) |
|
511 |
|
|
512 |
for (status, job_id) in result[constants.JOB_IDS_KEY]: |
|
513 |
jex.AddJobId(None, status, job_id) |
|
511 | 514 |
|
512 | 515 |
retcode = constants.EXIT_SUCCESS |
513 | 516 |
|
514 |
if bad_nodes: |
|
517 |
for (status, result) in jex.GetResults(): |
|
518 |
if not status: |
|
519 |
ToStdout("Job failed: %s", result) |
|
520 |
continue |
|
521 |
|
|
522 |
((bad_nodes, instances, missing), ) = result |
|
523 |
|
|
515 | 524 |
for node, text in bad_nodes.items(): |
516 | 525 |
ToStdout("Error gathering data on node %s: %s", |
517 | 526 |
node, utils.SafeEncode(text[-400:])) |
518 |
retcode |= 1
|
|
527 |
retcode = constants.EXIT_FAILURE
|
|
519 | 528 |
ToStdout("You need to fix these nodes first before fixing instances") |
520 | 529 |
|
521 |
if instances: |
|
522 | 530 |
for iname in instances: |
523 | 531 |
if iname in missing: |
524 | 532 |
continue |
... | ... | |
531 | 539 |
retcode |= nret |
532 | 540 |
ToStderr("Error activating disks for instance %s: %s", iname, msg) |
533 | 541 |
|
534 |
if missing: |
|
535 |
for iname, ival in missing.iteritems(): |
|
536 |
all_missing = compat.all(x[0] in bad_nodes for x in ival) |
|
537 |
if all_missing: |
|
538 |
ToStdout("Instance %s cannot be verified as it lives on" |
|
539 |
" broken nodes", iname) |
|
540 |
else: |
|
541 |
ToStdout("Instance %s has missing logical volumes:", iname) |
|
542 |
ival.sort() |
|
543 |
for node, vol in ival: |
|
544 |
if node in bad_nodes: |
|
545 |
ToStdout("\tbroken node %s /dev/%s", node, vol) |
|
546 |
else: |
|
547 |
ToStdout("\t%s /dev/%s", node, vol) |
|
548 |
|
|
549 |
ToStdout("You need to run replace or recreate disks for all the above"
|
|
550 |
" instances, if this message persist after fixing nodes.")
|
|
551 |
retcode |= 1
|
|
542 |
if missing:
|
|
543 |
for iname, ival in missing.iteritems():
|
|
544 |
all_missing = compat.all(x[0] in bad_nodes for x in ival)
|
|
545 |
if all_missing:
|
|
546 |
ToStdout("Instance %s cannot be verified as it lives on"
|
|
547 |
" broken nodes", iname)
|
|
548 |
else:
|
|
549 |
ToStdout("Instance %s has missing logical volumes:", iname)
|
|
550 |
ival.sort()
|
|
551 |
for node, vol in ival:
|
|
552 |
if node in bad_nodes:
|
|
553 |
ToStdout("\tbroken node %s /dev/%s", node, vol)
|
|
554 |
else:
|
|
555 |
ToStdout("\t%s /dev/%s", node, vol)
|
|
556 |
|
|
557 |
ToStdout("You need to replace or recreate disks for all the above"
|
|
558 |
" instances if this message persists after fixing broken nodes.")
|
|
559 |
retcode = constants.EXIT_FAILURE
|
|
552 | 560 |
|
553 | 561 |
return retcode |
554 | 562 |
|
Also available in: Unified diff