private static synchronized FloatingIp requestFloatingIp(Nova novaClient, String serverId) { FloatingIps ips = novaClient.floatingIps().list().execute(); FloatingIp ip = null; for(FloatingIp ip2 : ips) { // Look for an IP that is not yet associated to a VM if(ip2.getInstanceId() == null && ipAssociations.get(ip2.getId()) == null) { ip = ip2; ipAssociations.put(ip2.getId(), serverId); break; } } return ip; }
public Nova(String endpoint, OpenStackClientConnector connector) { super(endpoint, connector); EXTENSIONS = new ExtensionsResource(this); SERVERS = new ServersResource(this); IMAGES = new ImagesResource(this); FLAVORS = new FlavorsResource(this); KEY_PAIRS = new KeyPairsExtension(this); FLOATING_IPS = new FloatingIpsExtension(this); SECURITY_GROUPS = new SecurityGroupsExtension(this); SNAPSHOTS = new SnapshotsExtension(this); VOLUMES = new VolumesExtension(this); AGGREGATES = new AggregatesExtension(this); QUOTA_SETS = new QuotaSetsResource(this); HOSTS = new HostsExtension(this); SERVICES = new ServicesResource(this); HYPERVISORS = new HypervisorsResource(this); }
public Nova(String endpoint, OpenStackClientConnector connector) { super(endpoint, connector); EXTENSIONS = new ExtensionsResource(this); SERVERS = new ServersResource(this); IMAGES = new ImagesResource(this); FLAVORS = new FlavorsResource(this); KEY_PAIRS = new KeyPairsExtension(this); FLOATING_IPS = new FloatingIpsExtension(this); SECURITY_GROUPS = new SecurityGroupsExtension(this); SNAPSHOTS = new SnapshotsExtension(this); VOLUMES = new VolumesExtension(this); AGGREGATES = new AggregatesExtension(this); QUOTA_SETS = new QuotaSetsResource(this); HOSTS = new HostsExtension(this); SERVICES = new ServicesResource(this); HYPERVISORS = new HypervisorsResource(this); NETWORKS = new NetworksExtension(this); }
Context context = getContext(); FloatingIps ips = client.floatingIps().list().execute(); for (FloatingIp ip : ips.getList()) { if (pool == null || pool.equalsIgnoreCase(ip.getPool())) {
/** * @see com.att.cdp.zones.NetworkService#getFloatingIpPools() */ @SuppressWarnings("nls") @Override public List<String> getFloatingIpPools() throws ZoneException { HashSet<String> pools = new HashSet<>(); connect(); Context context = getContext(); trackRequest(); RequestState.put(RequestState.SERVICE, "Compute"); RequestState.put(RequestState.SERVICE_URL, novaConnector.getEndpoint()); FloatingIpsExtension extension = novaConnector.getClient().floatingIps(); if (extension == null) { throw new NotSupportedException(EELFResourceManager.format(OSMsg.PAL_OS_UNSUPPORTED_OPERATION, "getAvailableAddresses", context.getProvider().getName())); } try { for (FloatingIp ip : extension.list().execute()) { if (!pools.contains(ip.getPool())) { pools.add(ip.getPool()); } } } catch (OpenStackBaseException ex) { ExceptionMapper.mapException(ex); } return Collections.list(Collections.enumeration(pools)); }
FloatingIps ips = extension.list().execute(); for (FloatingIp ip : ips) { if (ip.getPool().equalsIgnoreCase(pool)) {