/** * Add Node/Group Entry * Add a Node and Group to the Topology Info. */ int cc_add_node_group_entry(cluster_config_t * cc, cc_node_t node, cc_group_t group ) { static char * meth = "add_node_group_entry()"; int rc = 0; // printf("[ENTER]<%s:%s> node(%u) group(%u)\n", MOD, meth, node, group ); // Look for the group -- if found, then save the index. // And, if not found, add it, and save the index. int group_ndx = cc_add_group( cc, group ); // Group is all set. Now add the node (we shouldn't have one already). int node_ndx = cc_add_node( cc, node ); // Quick validation step -- if the membership array shows a NON-negative // entry, point that out, but ALSO if( cc->membership[node_ndx] > 0 && cc->membership[node_ndx] != group_ndx) { cf_debug(AS_PARTITION, "[ERROR]<%s:%s>Adding NODE(%d) GROUP(%d) SET(%d)", MOD, meth, node, group, cc->membership[node_ndx] ); // printf( "[ERROR]<%s:%s>Adding NODE[%d](%u) GROUP[%d](%u) MEM(%d) \n", // MOD, meth, node_ndx, node, group_ndx, group, cc->membership[node_ndx] ); rc = -1; } // Just overwrite the weird case for now -- and we'll figure it out later. // TODO: Handle the overwrite error if it ever comes up. It would probably // be ONLY a user error -- but it most likely shows that the user screwed // up the config file. cc->membership[node_ndx] = group_ndx; cc->group_node_count[group_ndx]++; // One more in this group return rc; } // end add_node_group_entry()
/** * Add Node/Group Entry * Add a Node and Group to the Topology Info. */ int cc_add_node_group_entry(cluster_config_t *cc, const cc_node_t node, const cc_group_t group) { int rc = 0; // Look for the group -- if found, then save the index. // And, if not found, add it, and save the index. int group_ndx = cc_add_group(cc, group); // Group is all set. Now add the node (we shouldn't have one already). int node_ndx = cc_add_node(cc, node); // Quick validation step -- if the membership array shows a NON-negative // entry, point that out, but ALSO if (cc->membership[node_ndx] > 0 && cc->membership[node_ndx] != group_ndx) { cf_debug(AS_PARTITION, "adding node:%d group:%d set:%d", node, group, cc->membership[node_ndx]); rc = -1; } // Just overwrite the weird case for now -- and we'll figure it out later. // TODO: Handle the overwrite error if it ever comes up. It would probably // be ONLY a user error -- but it most likely shows that the user screwed // up the config file. cc->membership[node_ndx] = group_ndx; cc->group_node_count[group_ndx]++; // One more in this group return rc; } // end add_node_group_entry()