> +
> + if (!options.getNetworks().isEmpty()) {
> + List<Ip<?, ?>> ips = Lists.newArrayList();
> + Enterprise enterprise = adminService.getCurrentEnterprise();
> + Iterable<ExternalNetwork> externalNetworks =
> enterprise.listExternalNetworks(datacenter);
> +
> + for (String networkId : options.getNetworks()) {
> + Network<?> network =
> template.getVirtualDatacenter().getPrivateNetwork(Ints.tryParse(networkId));
> + if (network == null) {
> + // If the given network is not a private network, it should
> be an
> + // external one
> + network = find(externalNetworks, networkId(networkId));
> + }
> +
> + // Get the first available ip
> + Ip<?, ?> availableIp = get(network.listUnusedIps(), 0);
Is `network.listUnusedIps()` guaranteed to be non-empty?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/47/files#r8755783