Revision 781de953 lib/bootstrap.py
b/lib/bootstrap.py | ||
---|---|---|
268 | 268 |
begun in cmdlib.LUDestroyOpcode. |
269 | 269 |
|
270 | 270 |
""" |
271 |
if not rpc.RpcRunner.call_node_stop_master(master, True): |
|
271 |
result = rpc.RpcRunner.call_node_stop_master(master, True) |
|
272 |
if result.failed or not result.data: |
|
272 | 273 |
logging.warning("Could not disable the master role") |
273 |
if not rpc.RpcRunner.call_node_leave_cluster(master): |
|
274 |
result = rpc.RpcRunner.call_node_leave_cluster(master) |
|
275 |
if result.failed or not result.data: |
|
274 | 276 |
logging.warning("Could not shutdown the node daemon and cleanup the node") |
275 | 277 |
|
276 | 278 |
|
... | ... | |
363 | 365 |
|
364 | 366 |
logging.info("Setting master to %s, old master: %s", new_master, old_master) |
365 | 367 |
|
366 |
if not rpc.RpcRunner.call_node_stop_master(old_master, True): |
|
368 |
result = rpc.RpcRunner.call_node_stop_master(old_master, True) |
|
369 |
if result.failed or not result.data: |
|
367 | 370 |
logging.error("Could not disable the master role on the old master" |
368 | 371 |
" %s, please disable manually", old_master) |
369 | 372 |
|
... | ... | |
379 | 382 |
# cluster info |
380 | 383 |
cfg.Update(cluster_info) |
381 | 384 |
|
382 |
if not rpc.RpcRunner.call_node_start_master(new_master, True): |
|
385 |
result = rpc.RpcRunner.call_node_start_master(new_master, True) |
|
386 |
if result.failed or not result.data: |
|
383 | 387 |
logging.error("Could not start the master role on the new master" |
384 | 388 |
" %s, please check", new_master) |
385 | 389 |
rcode = 1 |
... | ... | |
425 | 429 |
other_masters = {} |
426 | 430 |
votes = {} |
427 | 431 |
for node in results: |
428 |
if not isinstance(results[node], (tuple, list)) or len(results[node]) < 3: |
|
432 |
nres = results[node] |
|
433 |
data = nres.data |
|
434 |
if nres.failed or not isinstance(data, (tuple, list)) or len(data) < 3: |
|
429 | 435 |
# here the rpc layer should have already logged errors |
430 | 436 |
if None not in votes: |
431 | 437 |
votes[None] = 0 |
432 | 438 |
votes[None] += 1 |
433 | 439 |
continue |
434 |
master_node = results[node][2]
|
|
440 |
master_node = data[2]
|
|
435 | 441 |
if master_node not in votes: |
436 | 442 |
votes[master_node] = 0 |
437 | 443 |
votes[master_node] += 1 |
Also available in: Unified diff