jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrea Turli <notificati...@github.com>
Subject Re: [jclouds/jclouds] [JCLOUDS-1382] improve usage of Neutron capabilities from Nova (#1178)
Date Thu, 15 Feb 2018 10:55:08 GMT
andreaturli commented on this pull request.



> +      Optional<Network> networkOptional = getNetworkApi(regionId).list().concat().firstMatch(new
Predicate<Network>() {
+         @Override
+         public boolean apply(@Nullable Network input) {
+            return input.getExternal() && input.getAvailabilityZone().equals(availabilityZone);
+         }
+      });
+      if (!networkOptional.isPresent())
+         throw new InsufficientResourcesException("Failed to find a suitable external network.");
+
+      org.jclouds.openstack.neutron.v2.domain.FloatingIP createFloatingIP = org.jclouds.openstack.neutron.v2.domain.FloatingIP.CreateFloatingIP
+              .createBuilder(networkOptional.get().getId())
+              .availabilityZone(networkOptional.get().getAvailabilityZone())
+              .build();
+
+      org.jclouds.openstack.neutron.v2.domain.FloatingIP floatingIP = neutronFloatingApi.create((org.jclouds.openstack.neutron.v2.domain.FloatingIP.CreateFloatingIP)
createFloatingIP);
+      floatingIpCache.asMap().putIfAbsent(RegionAndId.fromSlashEncoded(node.getId()), ImmutableList.of(FloatingIpForServer.create(RegionAndId.fromSlashEncoded(node.getId()),
floatingIP.getId(), floatingIP.getFloatingIpAddress())));

hmm, makes sense, although I was using the same approach used for Nova. Should I change line
141 as well?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1178#discussion_r168441009
Mime
View raw message