Revision 39bdcf76 lib/watcher/__init__.py
b/lib/watcher/__init__.py | ||
---|---|---|
512 | 512 |
_WriteInstanceStatus(filename, inststatus) |
513 | 513 |
|
514 | 514 |
|
515 |
def GetLuxiClient(try_restart, query=False):
|
|
516 |
"""Tries to connect to the master daemon.
|
|
515 |
def GetLuxiClient(try_restart): |
|
516 |
"""Tries to connect to the luxi daemon.
|
|
517 | 517 |
|
518 | 518 |
@type try_restart: bool |
519 | 519 |
@param try_restart: Whether to attempt to restart the master daemon |
520 | 520 |
|
521 | 521 |
""" |
522 | 522 |
try: |
523 |
return cli.GetClient(query=query)
|
|
523 |
return cli.GetClient() |
|
524 | 524 |
except errors.OpPrereqError, err: |
525 | 525 |
# this is, from cli.GetClient, a not-master case |
526 | 526 |
raise NotMasterError("Not on master node (%s)" % err) |
... | ... | |
529 | 529 |
if not try_restart: |
530 | 530 |
raise |
531 | 531 |
|
532 |
logging.warning("Master daemon seems to be down (%s), trying to restart",
|
|
532 |
logging.warning("Luxi daemon seems to be down (%s), trying to restart",
|
|
533 | 533 |
err) |
534 | 534 |
|
535 |
if not utils.EnsureDaemon(constants.MASTERD):
|
|
535 |
if not utils.EnsureDaemon(constants.LUXID):
|
|
536 | 536 |
raise errors.GenericError("Can't start the master daemon") |
537 | 537 |
|
538 | 538 |
# Retry the connection |
539 |
return cli.GetClient(query=query)
|
|
539 |
return cli.GetClient() |
|
540 | 540 |
|
541 | 541 |
|
542 | 542 |
def _StartGroupChildren(cl, wait): |
... | ... | |
615 | 615 |
|
616 | 616 |
try: |
617 | 617 |
client = GetLuxiClient(True) |
618 |
query_client = GetLuxiClient(True, query=True) |
|
619 | 618 |
except NotMasterError: |
620 | 619 |
# Don't proceed on non-master nodes |
621 | 620 |
return constants.EXIT_SUCCESS |
... | ... | |
639 | 638 |
_ArchiveJobs(client, opts.job_age) |
640 | 639 |
|
641 | 640 |
# Spawn child processes for all node groups |
642 |
_StartGroupChildren(query_client, opts.wait_children)
|
|
641 |
_StartGroupChildren(client, opts.wait_children) |
|
643 | 642 |
|
644 | 643 |
return constants.EXIT_SUCCESS |
645 | 644 |
|
... | ... | |
747 | 746 |
try: |
748 | 747 |
# Connect to master daemon |
749 | 748 |
client = GetLuxiClient(False) |
750 |
query_client = GetLuxiClient(False, query=True) |
|
751 | 749 |
|
752 | 750 |
_CheckMaster(client) |
753 | 751 |
|
754 |
(nodes, instances) = _GetGroupData(query_client, group_uuid)
|
|
752 |
(nodes, instances) = _GetGroupData(client, group_uuid) |
|
755 | 753 |
|
756 | 754 |
# Update per-group instance status file |
757 | 755 |
_UpdateInstanceStatus(inst_status_path, instances.values()) |
Also available in: Unified diff