> -      try {
> -         logger.debug(">> allocating or reassigning floating ip for 
> node(%s)", node.getId());
> -         ip = floatingIpApi.create();
> -      } catch (InsufficientResourcesException e) {
> -         logger.trace("<< [%s] allocating a new floating ip for node(%s)", 
> e.getMessage(), node.getId());
> -         logger.trace(">> searching for existing, unassigned floating ip for 
> node(%s)", node.getId());
> -         ArrayList<FloatingIP> unassignedIps = 
> Lists.newArrayList(Iterables.filter(floatingIpApi.list(),
> -                  new Predicate<FloatingIP>() {
> +      
> +      // 1.) Attempt to allocate from optionally passed poolNames
> +      if (poolNames.isPresent()){
> +         for (String poolName : poolNames.get()){
> +            try {
> +               logger.debug(">> allocating floating IP from pool %s for 
> node(%s)", poolName, nodeID);
> +               ip = floatingIpApi.allocateFromPool(poolName);
> +               if (ip != null){

Just `return` here to avoid having so much "if" statements? Code may look 
cleaner

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/425/files#r14585898

Reply via email to