> @@ -94,6 +97,12 @@ public boolean apply(FloatingIP arg0) {
>           // try to prevent multiple parallel launches from choosing the same 
> ip.
>           Collections.shuffle(unassignedIps);
>           ip = Iterables.getLast(unassignedIps);
> +         
> +         //if we are still unable to allocate IP, even after iterating 
> through all 
> +         //available, then re-throw IRE as there is nothing left we can do
> +         if(ip == null){
> +         throw new InsufficientResourcesException("Failed to allocate a 
> FloatingIP for node(" + node.getId() + ")",e);
> +         }
>        }
>        logger.debug(">> adding floatingIp(%s) to node(%s)", ip.getIp(), 
> node.getId());

Gotcha. I guess my next thought would then be: if we don't want to throw an IRE 
when "FloatingIPApi.create()" returns null but instead search through listed 
IP's (much like the caught IRE does now) then what do we want to do should both 
fail? It seems to me to throw an IRE!!! Do we want to let the null fall through 
which eventually gets us an NPE (wrapped in a RunNodesException)? It seems the 
IRE is more descriptive but maybe throwing an NPE with a detailed message will 
suffice?

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

Reply via email to