jclouds-notifications mailing list archives

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



>        return floatingIP;
    }
 
+
+   private List<Network> getNetworksFromPoolNames(String regionId, final Optional<Set<String>>
poolNames) {
+      return getNetworkApi(regionId).list().concat().filter(new Predicate<Network>()
{

if the pool name set is absent or empty, just return an empty list here. There is no need
to filter in that case, nor to have that check in the predicate, applying it on every iteration.

>  
-      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();
+      // 2.) Attempt to allocate from a external network
+      if (floatingIP == null) {
+         Optional<Network> networkOptional = Iterables.tryFind(networks, new Predicate<Network>()
{
+            @Override
+            public boolean apply(Network input) {
+               return availabilityZone.equals(input.getAvailabilityZone()) && input.getExternal();
+            }
+         });

If the pool names is a list of more than one element, we try to allocate the floating IP in
one of the given networks. Why not apply the same pattern if no network is defined? We can
try every external network in the same availability zone, following the exact same pattern.

>     public NovaComputeServiceLiveTest() {
       provider = "openstack-nova";
-
-      Properties overrides = setupProperties();
-      neutronApiContext = ContextBuilder.newBuilder("openstack-neutron")
-              .endpoint(setIfTestSystemPropertyPresent(overrides,
-                      "openstack-nova.endpoint"))
-              .credentials(setIfTestSystemPropertyPresent(overrides,
-                      "openstack-nova.identity"),
-                      setIfTestSystemPropertyPresent(overrides, "openstack-nova.credential"))
-              .modules(ImmutableSet.<Module>of(
-                      new SshjSshClientModule(),
-                      new SLF4JLoggingModule(),
-                      new BouncyCastleCryptoModule())
-              )
-              //        TypeToken<? extends Context> contextType = new TypeToken<ApiContext<NeutronApi>>()
{};
-              .build();

Now there is no way to test the neutron integration? We should provide a NovaWithNeutron live
test class to test this new feature.

-- 
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#pullrequestreview-96852068
Mime
View raw message