Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
initial broker pairing algo
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Dec 2, 2011
1 parent 070d38b commit 660891d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
1 change: 0 additions & 1 deletion cluster/handlers-state.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ int doDescribeServices(ncMetadata *ccMeta, serviceInfoType *serviceIds, int serv
}
*/
sem_mywait(CONFIG);
logprintfl(EUCADEBUG, "MEH: %s\n", config->ccStatus.serviceId.name);
if (!strcmp(config->ccStatus.serviceId.name, "self")) {
for (i=0; i<serviceIdsLen; i++) {
logprintfl(EUCADEBUG, "DescribeServices(): received input serviceId[%d]\n", i);
Expand Down
29 changes: 28 additions & 1 deletion cluster/handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -2813,6 +2813,8 @@ int ccCheckState() {
char localDetails[1024];
int ret=0;
char cmd[MAX_PATH];
char buri[MAX_PATH], uriType[32], bhost[MAX_PATH], path[MAX_PATH], curi[MAX_PATH], chost[MAX_PATH];
int port, done=0, i, j, rc;

if (!config) {
return(1);
Expand Down Expand Up @@ -2857,6 +2859,31 @@ int ccCheckState() {

// network

// broker pairing algo
for (i=0; i<16; i++) {
int j;
if (strlen(config->notreadyServices[i].type)) {
if (!strcmp(config->notreadyServices[i].type, "vmwarebroker")) {
for (j=0; j<8; j++) {
if (strlen(config->notreadyServices[i].uris[j])) {
logprintfl(EUCADEBUG, "ccCheckState(): found broker - %s\n", config->notreadyServices[i].uris[j]);

snprintf(buri, MAX_PATH, "%s", config->notreadyServices[i].uris[j]);
bzero(bhost, sizeof(char) * MAX_PATH);
rc = tokenize_uri(buri, uriType, bhost, &port, path);

snprintf(curi, MAX_PATH, "%s", config->ccStatus.serviceId.uris[0]);
bzero(chost, sizeof(char) * MAX_PATH);
rc = tokenize_uri(curi, uriType, chost, &port, path);
if (!strcmp(curi, buri)) {
logprintfl(EUCAWARN, "ccCheckState(): detected local broker in not ready state\n");
}
}
}
}
}
}

snprintf(localDetails, 1023, "ERRORS=%d", ret);
sem_mywait(CONFIG);
snprintf(config->ccStatus.details, 1023, "%s", localDetails);
Expand Down Expand Up @@ -3760,7 +3787,7 @@ int init_config(void) {
config->ncFanout = ncFanout;
locks[REFRESHLOCK] = sem_open("/eucalyptusCCrefreshLock", O_CREAT, 0644, config->ncFanout);
config->initialized = 1;
ccChangeState(LOADED);
ccChangeState(NOTREADY);
config->ccStatus.localEpoch = 0;
snprintf(config->ccStatus.details, 1024, "ERRORS=0");
snprintf(config->ccStatus.serviceId.type, 32, "cluster");
Expand Down

0 comments on commit 660891d

Please sign in to comment.