@Override public RegionAndId apply(RegionAndId id) { if (isNeutronLinked()) { for (FloatingIpForServer floatingIpForServer : floatingIpCache.getUnchecked(id)) { logger.debug(">> deallocating floatingIp(%s)", floatingIpForServer); getFloatingIPApi(id.getRegion()).delete(floatingIpForServer.floatingIpId()); } } else { // try nova FloatingIPApi floatingIpApi = novaApi.getFloatingIPApi(id.getRegion()).get(); for (FloatingIpForServer floatingIpForServer : floatingIpCache.getUnchecked(id)) { logger.debug(">> removing floatingIp(%s) from node(%s)", floatingIpForServer, id); floatingIpApi.removeFromServer(floatingIpForServer.ip(), id.getId()); logger.debug(">> deallocating floatingIp(%s)", floatingIpForServer); floatingIpApi.delete(floatingIpForServer.floatingIpId()); } } floatingIpCache.invalidate(id); return id; }
@Override public RegionAndId apply(RegionAndId id) { if (isNeutronLinked()) { for (FloatingIpForServer floatingIpForServer : floatingIpCache.getUnchecked(id)) { logger.debug(">> deallocating floatingIp(%s)", floatingIpForServer); getFloatingIPApi(id.getRegion()).delete(floatingIpForServer.floatingIpId()); } } else { // try nova FloatingIPApi floatingIpApi = novaApi.getFloatingIPApi(id.getRegion()).get(); for (FloatingIpForServer floatingIpForServer : floatingIpCache.getUnchecked(id)) { logger.debug(">> removing floatingIp(%s) from node(%s)", floatingIpForServer, id); floatingIpApi.removeFromServer(floatingIpForServer.ip(), id.getId()); logger.debug(">> deallocating floatingIp(%s)", floatingIpForServer); floatingIpApi.delete(floatingIpForServer.floatingIpId()); } } floatingIpCache.invalidate(id); return id; }