mirror of https://github.com/apache/jclouds.git
bug fix in load balancer
This commit is contained in:
parent
a96d332ea4
commit
3b89b8bcd7
|
@ -101,23 +101,21 @@ public class BaseLoadBalancerService implements LoadBalancerService {
|
||||||
checkArgument(protocol.toUpperCase().equals("HTTP") || protocol.toUpperCase().equals("TCP"),
|
checkArgument(protocol.toUpperCase().equals("HTTP") || protocol.toUpperCase().equals("TCP"),
|
||||||
"Acceptable values for protocol are HTTP or TCP");
|
"Acceptable values for protocol are HTTP or TCP");
|
||||||
|
|
||||||
Map<Location, Set<String>> locationMap = Maps.newHashMap();
|
Set<String> ids = Sets.newHashSet();
|
||||||
|
Location location = null;
|
||||||
for (NodeMetadata node : Iterables.filter(context.getComputeService().listNodesDetailsMatching(
|
for (NodeMetadata node : Iterables.filter(context.getComputeService().listNodesDetailsMatching(
|
||||||
NodePredicates.all()), Predicates.and(filter, Predicates.not(NodePredicates.TERMINATED)))) {
|
NodePredicates.all()), filter)) {
|
||||||
Set<String> ids = locationMap.get(node.getLocation());
|
|
||||||
if (ids == null)
|
|
||||||
ids = Sets.newHashSet();
|
|
||||||
ids.add(node.getProviderId());
|
ids.add(node.getProviderId());
|
||||||
locationMap.put(node.getLocation(), ids);
|
location = node.getLocation();
|
||||||
}
|
}
|
||||||
Set<String> dnsNames = Sets.newHashSet();
|
Set<String> dnsNames = Sets.newHashSet();
|
||||||
for (Location location : locationMap.keySet()) {
|
|
||||||
logger.debug(">> creating load balancer (%s)", loadBalancerName);
|
logger.debug(">> creating load balancer (%s)", loadBalancerName);
|
||||||
String dnsName = loadBalancerStrategy.execute(location, loadBalancerName, protocol, loadBalancerPort,
|
String dnsName = loadBalancerStrategy.execute(location, loadBalancerName, protocol, loadBalancerPort,
|
||||||
instancePort, locationMap.get(location));
|
instancePort, ids);
|
||||||
dnsNames.add(dnsName);
|
dnsNames.add(dnsName);
|
||||||
logger.debug("<< created load balancer (%s) DNS (%s)", loadBalancerName, dnsName);
|
logger.debug("<< created load balancer (%s) DNS (%s)", loadBalancerName, dnsName);
|
||||||
}
|
|
||||||
return dnsNames;
|
return dnsNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue