retrieveCaches();
/*
- * Read startup and build database if we have not already gotten the
- * configurations synced from another node
+ * Read startup and build database if we are the coordinator
*/
- if (subnetsConfigList.isEmpty()) {
+ if ((clusterContainerService != null) && (clusterContainerService.amICoordinator())) {
loadSubnetConfiguration();
- }
- if (spanConfigList.isEmpty()) {
loadSpanConfiguration();
- }
- if (nodeConfigList.isEmpty()) {
loadSwitchConfiguration();
}
@SuppressWarnings({ "unchecked" })
private void retrieveCaches() {
if (this.clusterContainerService == null) {
- log.info("un-initialized clusterContainerService, can't create cache");
+ log.warn("un-initialized clusterContainerService, can't create cache");
return;
}
@Override
public SubnetConfig getSubnetConfig(String subnet) {
// if there are no subnets, return the default subnet
- if(subnetsConfigList.size() == 0 && subnet == DEFAULT_SUBNET_NAME){
+ if(subnetsConfigList.isEmpty() && subnet.equalsIgnoreCase(DEFAULT_SUBNET_NAME)){
return DEFAULT_SUBNETCONFIG;
}else{
return subnetsConfigList.get(subnet);
}
private Status semanticCheck(SubnetConfig conf) {
- Subnet newSubnet = new Subnet(conf);
Set<InetAddress> IPs = subnets.keySet();
if (IPs == null) {
return new Status(StatusCode.SUCCESS);
}
+ Subnet newSubnet = new Subnet(conf);
for (InetAddress i : IPs) {
Subnet existingSubnet = subnets.get(i);
if ((existingSubnet != null) && !existingSubnet.isMutualExclusive(newSubnet)) {
return status;
}
} else {
- if (conf.getName().equals(DEFAULT_SUBNET_NAME)) {
+ if (conf.getName().equalsIgnoreCase(DEFAULT_SUBNET_NAME)) {
return new Status(StatusCode.NOTALLOWED, "The specified subnet gateway cannot be removed");
}
}
@Override
public Status removeSubnet(String name) {
- if (name.equals(DEFAULT_SUBNET_NAME)) {
+ if (name.equalsIgnoreCase(DEFAULT_SUBNET_NAME)) {
return new Status(StatusCode.NOTALLOWED, "The specified subnet gateway cannot be removed");
}
SubnetConfig conf = subnetsConfigList.get(name);
return;
}
- log.info("Set Node {}'s Mode to {}", nodeId, cfgObject.getMode());
+ log.trace("Set Node {}'s Mode to {}", nodeId, cfgObject.getMode());
if (modeChange) {
notifyModeChange(node, cfgObject.isProactive());
private void updateNode(Node node, Set<Property> props) {
log.trace("{} updated, props: {}", node, props);
- if (nodeProps == null || !nodeProps.containsKey(node) ||
- props == null || props.isEmpty()) {
+ if (nodeProps == null || props == null) {
return;
}
if (nodeProps.replace(node, propMapCurr, propMap)) {
return;
}
- if (!propMapCurr.get(prop.getName()).equals(nodeProps.get(node).get(prop.getName()))) {
- log.debug("Cluster conflict: Unable to add property {} to node {}.", prop.getName(), node.getID());
- return;
- }
}
log.warn("Cluster conflict: Unable to add property {} to node {}.", prop.getName(), node.getID());
}
if (nodeProps.replace(node, propMapCurr, propMap)) {
return new Status(StatusCode.SUCCESS);
}
- if (!propMapCurr.get(propName).equals(nodeProps.get(node).get(propName))) {
- String msg = "Cluster conflict: Unable to remove property " + propName + " for node "
- + node.getID();
- return new Status(StatusCode.CONFLICT, msg);
- }
-
} else {
return new Status(StatusCode.SUCCESS);
}
if (macAddress == null) {
log.warn("Failed to acquire controller MAC: No physical interface found");
// This happens when running controller on windows VM, for example
- // Try parsing the OS command output
+ // TODO: Try parsing the OS command output
+ // For now provide a quick fix for the release
+ macAddress = new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x0c, (byte) 0x60, (byte) 0x0D, (byte) 0x10 };
+ log.debug("Assigning custom MAC address to controller");
}
return macAddress;
}