Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix (improvement) to CC/VMWare convergance algorithm when CC/Broker n…

…ot in HA mode: RT: #6578
  • Loading branch information...
commit 7da5760e20a6e41abd737b17632defd573e9dded 1 parent 320d4a1
Daniel Nurmi authored
View
2  clc/modules/msgs/src/main/resources/cc-services.xml
@@ -70,7 +70,7 @@
</mapping>
<mapping class="com.eucalyptus.empyrean.ServiceId" abstract="true">
<!-- <value name="uuid" field="uuid" usage="optional" /> -->
-<!-- <value name="partition" field="partition" usage="optional" /> -->
+ <value name="partition" field="partition" usage="optional"/>
<value name="type" field="type" usage="required" />
<value name="name" field="name" usage="required" />
<collection field="uris" factory="org.jibx.runtime.Utility.arrayListFactory">
View
1  clc/modules/www/src/main/java/com/eucalyptus/webui/public/themes/active
@@ -1 +0,0 @@
-eucalyptus
View
1  clc/modules/www/src/main/java/com/eucalyptus/webui/public/themes/active
View
5 cluster/CCclient.c
@@ -82,8 +82,9 @@ int main(int argc, char **argv) {
mymeta.correlationId = strdup("1234abcd");
mymeta.epoch = 3;
mymeta.servicesLen = 16;
- snprintf(mymeta.services[15].name, 16, "eucalyptus");
- snprintf(mymeta.services[15].type, 16, "eucalyptus");
+ snprintf(mymeta.services[15].name, 16, "eucalyptusname");
+ snprintf(mymeta.services[15].type, 16, "eucalyptustype");
+ snprintf(mymeta.services[15].partition, 16, "eucalyptuspart");
mymeta.services[15].urisLen = 1;
snprintf(mymeta.services[15].uris[0], 512, "http://192.168.254.3:8773/services/Eucalyptus");
View
8 cluster/handlers-state.c
@@ -125,7 +125,7 @@ int doDescribeServices(ncMetadata *ccMeta, serviceInfoType *serviceIds, int serv
snprintf(uri, MAX_PATH, "%s", serviceIds[i].uris[0]);
rc = tokenize_uri(uri, uriType, host, &port, path);
if (strlen(host)) {
- logprintfl(EUCADEBUG, "DescribeServices(): setting local serviceId to input serviceId (type=%s name=%s)\n", SP(serviceIds[i].type), SP(serviceIds[i].name));
+ logprintfl(EUCADEBUG, "DescribeServices(): setting local serviceId to input serviceId (type=%s name=%s partition=%s)\n", SP(serviceIds[i].type), SP(serviceIds[i].name), SP(serviceIds[i].partition));
memcpy(&(config->ccStatus.serviceId), &(serviceIds[i]), sizeof(serviceInfoType));
}
}
@@ -137,7 +137,7 @@ int doDescribeServices(ncMetadata *ccMeta, serviceInfoType *serviceIds, int serv
for (i=0; i<16; i++) {
int j;
if (strlen(config->services[i].type)) {
- logprintfl(EUCADEBUG, "DescribeServices(): internal serviceInfos type=%s name=%s urisLen=%d\n", config->services[i].type, config->services[i].name, config->services[i].urisLen);
+ logprintfl(EUCADEBUG, "DescribeServices(): internal serviceInfos type=%s name=%s partition=%s urisLen=%d\n", config->services[i].type, config->services[i].name, config->services[i].partition, config->services[i].urisLen);
for (j=0; j<8; j++) {
if (strlen(config->services[i].uris[j])) {
logprintfl(EUCADEBUG, "DescribeServices(): internal serviceInfos\t uri[%d]:%s\n", j, config->services[i].uris[j]);
@@ -149,7 +149,7 @@ int doDescribeServices(ncMetadata *ccMeta, serviceInfoType *serviceIds, int serv
for (i=0; i<16; i++) {
int j;
if (strlen(config->disabledServices[i].type)) {
- logprintfl(EUCADEBUG, "DescribeServices(): internal disabled serviceInfos type=%s name=%s urisLen=%d\n", config->disabledServices[i].type, config->disabledServices[i].name, config->disabledServices[i].urisLen);
+ logprintfl(EUCADEBUG, "DescribeServices(): internal disabled serviceInfos type=%s name=%s partition=%s urisLen=%d\n", config->disabledServices[i].type, config->disabledServices[i].name, config->disabledServices[i].partition, config->disabledServices[i].urisLen);
for (j=0; j<8; j++) {
if (strlen(config->disabledServices[i].uris[j])) {
logprintfl(EUCADEBUG, "DescribeServices(): internal disabled serviceInfos\t uri[%d]:%s\n", j, config->disabledServices[i].uris[j]);
@@ -161,7 +161,7 @@ int doDescribeServices(ncMetadata *ccMeta, serviceInfoType *serviceIds, int serv
for (i=0; i<16; i++) {
int j;
if (strlen(config->notreadyServices[i].type)) {
- logprintfl(EUCADEBUG, "DescribeServices(): internal not ready serviceInfos type=%s name=%s urisLen=%d\n", config->notreadyServices[i].type, config->notreadyServices[i].name, config->notreadyServices[i].urisLen);
+ logprintfl(EUCADEBUG, "DescribeServices(): internal not ready serviceInfos type=%s name=%s partition=%s urisLen=%d\n", config->notreadyServices[i].type, config->notreadyServices[i].name, config->notreadyServices[i].partition, config->notreadyServices[i].urisLen);
for (j=0; j<8; j++) {
if (strlen(config->notreadyServices[i].uris[j])) {
logprintfl(EUCADEBUG, "DescribeServices(): internal not ready serviceInfos\t uri[%d]:%s\n", j, config->notreadyServices[i].uris[j]);
View
76 cluster/handlers.c
@@ -2829,8 +2829,7 @@ int ccCheckState(int clcTimer) {
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;
+ int port, done=0, i, j, rc, local_broker_down, is_ha_cc;
if (!config) {
return(1);
@@ -2911,8 +2910,67 @@ int ccCheckState(int clcTimer) {
}
// broker pairing algo
+ rc = doBrokerPairing();
+ if (rc) {
+ ret++;
+ }
+
+ snprintf(localDetails, 1023, "ERRORS=%d", ret);
+ snprintf(config->ccStatus.details, 1023, "%s", localDetails);
+
+ return(ret);
+}
+
+int doBrokerPairing() {
+ int ret, rc, local_broker_down, i, j, is_ha_cc, port;
+ char buri[MAX_PATH], uriType[32], bhost[MAX_PATH], path[MAX_PATH], curi[MAX_PATH], chost[MAX_PATH];
+
+ ret = 0;
+ local_broker_down = 0;
+ is_ha_cc = 0;
+
+ snprintf(curi, MAX_PATH, "%s", config->ccStatus.serviceId.uris[0]);
+ bzero(chost, sizeof(char) * MAX_PATH);
+ rc = tokenize_uri(curi, uriType, chost, &port, path);
+
+ //enabled
+ for (i=0; i<16; i++) {
+ if (!strcmp(config->ccStatus.serviceId.name, "self")) {
+ // logprintfl(EUCADEBUG, "ccCheckState(): local CC service info not yet initialized\n");
+ } else if (!memcmp(&(config->ccStatus.serviceId), &(config->services[i]), sizeof(serviceInfoType))) {
+ // logprintfl(EUCADEBUG, "ccCheckState(): found local CC information in services()\n");
+ } else if (!strcmp(config->services[i].type, "cluster") && !strcmp(config->services[i].partition, config->ccStatus.serviceId.partition)) {
+ // service is not 'me', but is a 'cluster' and in has the same 'partition', must be in HA mode
+ // logprintfl(EUCADEBUG, "ccCheckState(): CC is in HA mode\n");
+ is_ha_cc = 1;
+ }
+ }
+ //disabled
+ for (i=0; i<16; i++) {
+ if (!strcmp(config->ccStatus.serviceId.name, "self")) {
+ // logprintfl(EUCADEBUG, "ccCheckState(): local CC service info not yet initialized\n");
+ } else if (!memcmp(&(config->ccStatus.serviceId), &(config->disabledServices[i]), sizeof(serviceInfoType))) {
+ // logprintfl(EUCADEBUG, "ccCheckState(): found local CC information in disabled services()\n");
+ } else if (!strcmp(config->disabledServices[i].type, "cluster") && !strcmp(config->disabledServices[i].partition, config->ccStatus.serviceId.partition)) {
+ // service is not 'me', but is a 'cluster' and in has the same 'partition', must be in HA mode
+ // logprintfl(EUCADEBUG, "ccCheckState(): CC is in HA mode\n");
+ is_ha_cc = 1;
+ }
+ }
+ //notready
for (i=0; i<16; i++) {
int j;
+ //test
+ if (!strcmp(config->ccStatus.serviceId.name, "self")) {
+ // logprintfl(EUCADEBUG, "ccCheckState(): local CC service info not yet initialized\n");
+ } else if (!memcmp(&(config->ccStatus.serviceId), &(config->notreadyServices[i]), sizeof(serviceInfoType))) {
+ // logprintfl(EUCADEBUG, "ccCheckState(): found local CC information in notreadyServices()\n");
+ } else if (!strcmp(config->notreadyServices[i].type, "cluster") && !strcmp(config->notreadyServices[i].partition, config->ccStatus.serviceId.partition)) {
+ // service is not 'me', but is a 'cluster' and in has the same 'partition', must be in HA mode
+ // logprintfl(EUCADEBUG, "ccCheckState(): CC is in HA mode\n");
+ is_ha_cc = 1;
+ }
+
if (strlen(config->notreadyServices[i].type)) {
if (!strcmp(config->notreadyServices[i].type, "vmwarebroker")) {
for (j=0; j<8; j++) {
@@ -2923,13 +2981,11 @@ int ccCheckState(int clcTimer) {
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);
logprintfl(EUCADEBUG, "ccCheckState(): comparing found not ready broker host (%s) with local CC host (%s)\n", bhost, chost);
if (!strcmp(chost, bhost)) {
logprintfl(EUCAWARN, "ccCheckState(): detected local broker (%s) matching local CC (%s) in NOTREADY state\n", bhost, chost);
- ret++;
+ // ret++;
+ local_broker_down = 1;
}
}
}
@@ -2937,9 +2993,10 @@ int ccCheckState(int clcTimer) {
}
}
- snprintf(localDetails, 1023, "ERRORS=%d", ret);
- snprintf(config->ccStatus.details, 1023, "%s", localDetails);
-
+ if (local_broker_down && is_ha_cc) {
+ logprintfl(EUCADEBUG, "ccCheckState(): detected CC in HA mode, and local broker is not ENABLED\n", local_broker_down, is_ha_cc);
+ ret++;
+ }
return(ret);
}
@@ -3871,6 +3928,7 @@ int init_config(void) {
snprintf(config->ccStatus.details, 1024, "ERRORS=0");
snprintf(config->ccStatus.serviceId.type, 32, "cluster");
snprintf(config->ccStatus.serviceId.name, 32, "self");
+ snprintf(config->ccStatus.serviceId.partition, 32, "unset");
config->ccStatus.serviceId.urisLen=0;
for (i=0; i<32 && config->ccStatus.serviceId.urisLen < 8; i++) {
if (vnetconfig->localIps[i]) {
View
1  cluster/handlers.h
@@ -308,6 +308,7 @@ void unlock_exit(int);
void shawn(void);
int ncClientCall(ncMetadata *meta, int timeout, int ncLock, char *ncURL, char *ncOp, ...);
int ncGetTimeout(time_t op_start, time_t op_max, int numCalls, int idx);
+int doBrokerPairing(void);
int refresh_resources(ncMetadata *ccMeta, int timeout, int dolock);
int refresh_instances(ncMetadata *ccMeta, int timeout, int dolock);
View
6 util/adb-helpers.h
@@ -14,6 +14,7 @@
sit = adb_##thefunc##_get_services_at(theadb, env, i); \
snprintf(themeta->services[i].type,32,"%s",adb_serviceInfoType_get_type(sit, env)); \
snprintf(themeta->services[i].name,32,"%s",adb_serviceInfoType_get_name(sit, env)); \
+ snprintf(themeta->services[i].partition,32,"%s",adb_serviceInfoType_get_partition(sit, env)); \
themeta->services[i].urisLen = adb_serviceInfoType_sizeof_uris(sit, env); \
for (j=0; j<themeta->services[i].urisLen && j < 8; j++) { \
snprintf(themeta->services[i].uris[j], 512, "%s",adb_serviceInfoType_get_uris_at(sit, env, j)); \
@@ -24,6 +25,7 @@
sit = adb_##thefunc##_get_disabledServices_at(theadb, env, i); \
snprintf(themeta->disabledServices[i].type,32,"%s",adb_serviceInfoType_get_type(sit, env)); \
snprintf(themeta->disabledServices[i].name,32,"%s",adb_serviceInfoType_get_name(sit, env)); \
+ snprintf(themeta->disabledServices[i].partition,32,"%s",adb_serviceInfoType_get_partition(sit, env)); \
themeta->disabledServices[i].urisLen = adb_serviceInfoType_sizeof_uris(sit, env); \
for (j=0; j<themeta->disabledServices[i].urisLen && j < 8; j++) { \
snprintf(themeta->disabledServices[i].uris[j], 512, "%s",adb_serviceInfoType_get_uris_at(sit, env, j)); \
@@ -34,6 +36,7 @@
sit = adb_##thefunc##_get_notreadyServices_at(theadb, env, i); \
snprintf(themeta->notreadyServices[i].type,32,"%s",adb_serviceInfoType_get_type(sit, env)); \
snprintf(themeta->notreadyServices[i].name,32,"%s",adb_serviceInfoType_get_name(sit, env)); \
+ snprintf(themeta->notreadyServices[i].partition,32,"%s",adb_serviceInfoType_get_partition(sit, env)); \
themeta->notreadyServices[i].urisLen = adb_serviceInfoType_sizeof_uris(sit, env); \
for (j=0; j<themeta->notreadyServices[i].urisLen && j < 8; j++) { \
snprintf(themeta->notreadyServices[i].uris[j], 512, "%s",adb_serviceInfoType_get_uris_at(sit, env, j)); \
@@ -53,6 +56,7 @@
sit = adb_serviceInfoType_create(env); \
adb_serviceInfoType_set_type(sit, env, themeta->services[i].type); \
adb_serviceInfoType_set_name(sit, env, themeta->services[i].name); \
+ adb_serviceInfoType_set_partition(sit, env, themeta->services[i].partition); \
for (j=0; j<themeta->services[i].urisLen && j < 8; j++) { \
adb_serviceInfoType_add_uris(sit, env, themeta->services[i].uris[j]); \
} \
@@ -154,6 +158,7 @@ static inline adb_serviceInfoType_t * copy_service_info_type_to_adb(const axutil
adb_serviceInfoType_set_type(sit, env, input->type);
adb_serviceInfoType_set_name(sit, env, input->name);
+ adb_serviceInfoType_set_partition(sit, env, input->partition);
for (i=0; i<input->urisLen; i++) {
adb_serviceInfoType_add_uris(sit, env, input->uris[i]);
}
@@ -166,6 +171,7 @@ static inline void copy_service_info_type_from_adb(serviceInfoType * input, adb_
snprintf(input->type, 32, "%s", adb_serviceInfoType_get_type(sit, env));
snprintf(input->name, 32, "%s", adb_serviceInfoType_get_name(sit, env));
+ snprintf(input->partition, 32, "%s", adb_serviceInfoType_get_partition(sit, env));
input->urisLen = adb_serviceInfoType_sizeof_uris(sit, env);
for (i=0; i<input->urisLen && i<8; i++) {
snprintf(input->uris[i], 512, "%s", adb_serviceInfoType_get_uris_at(sit, env, i));
View
1  util/data.h
@@ -81,6 +81,7 @@ typedef struct publicAddressType_t {
typedef struct serviceInfoType_t {
char type[32];
char name[32];
+ char partition[32];
char uris[8][512];
int urisLen;
} serviceInfoType;
View
1  wsdl/eucalyptus_cc.wsdl
@@ -101,6 +101,7 @@
<xs:complexType abstract="true" name="serviceInfoType">
<xs:sequence>
+ <xs:element nillable="true" minOccurs="0" maxOccurs="1" name="partition" type="xs:string"/>
<xs:element nillable="false" minOccurs="0" maxOccurs="1" name="type" type="xs:string"/>
<xs:element nillable="false" minOccurs="0" maxOccurs="1" name="name" type="xs:string"/>
<xs:element nillable="false" minOccurs="0" maxOccurs="unbounded" name="uris" type="xs:string"/>
View
1  wsdl/eucalyptus_nc.wsdl
@@ -27,6 +27,7 @@
<xs:complexType abstract="true" name="serviceInfoType">
<xs:sequence>
+ <xs:element nillable="true" minOccurs="0" maxOccurs="1" name="partition" type="xs:string"/>
<xs:element nillable="false" minOccurs="0" maxOccurs="1" name="type" type="xs:string"/>
<xs:element nillable="false" minOccurs="0" maxOccurs="1" name="name" type="xs:string"/>
<xs:element nillable="false" minOccurs="0" maxOccurs="unbounded" name="uris" type="xs:string"/>
Please sign in to comment.
Something went wrong with that request. Please try again.