brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bostko <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #355: Reduce decisions for HostAndPort which wi...
Date Mon, 03 Oct 2016 08:38:43 GMT
Github user bostko commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/355#discussion_r81509871
  
    --- Diff: locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
---
    @@ -1956,6 +1955,33 @@ protected LoginCredentials createUser(ComputeService computeService,
NodeMetadat
             return userCreation.createdUserCredentials;
         }
     
    +    protected HostAndPort resolveManagementHostAndPort(ComputeService computeService,
NodeMetadata node, String vmHostname, Optional<HostAndPort> hostAndPortOverride, ConfigBag
config) {
    +        return resolveManagementHostAndPort(computeService, node, vmHostname, hostAndPortOverride,
config, false);
    +    }
    +
    +    protected HostAndPort resolveManagementHostAndPort(ComputeService computeService,
NodeMetadata node, String vmHostname, Optional<HostAndPort> hostAndPortOverride, ConfigBag
config, boolean useOnlyVmHostNameAndHostAndPortOverride) {
    +        String pollForFirstReachable = config.get(POLL_FOR_FIRST_REACHABLE_ADDRESS);
    +        boolean pollForFirstReachableEnabled = !useOnlyVmHostNameAndHostAndPortOverride
&& !"false".equalsIgnoreCase(pollForFirstReachable);
    +
    +        String managementAddress = hostAndPortOverride.isPresent() ? hostAndPortOverride.get().getHostText()
:
    +                (pollForFirstReachableEnabled ? getFirstReachableAddress(node, config)
: vmHostname);
    +        int managementPort = hostAndPortOverride.isPresent() ? hostAndPortOverride.get().getPort()
: node.getLoginPort();
    +        try {
    +            Networking.getInetAddressWithFixedName(managementAddress);
    --- End diff --
    
    This was always used before.
    
    Networking.getInetAddressWithFixedName is expecting two kinds of arguments:
    - IPv4 or IPv6 address - when this is used it doesn't resolve the address or trying to
reach it. It just checks whether it is formatted correctly.
    - hostname - it tries to `private static InetAddress[] getAllByName0 (String host, InetAddress
reqAddr, boolean check)` which uses `InetAddress.lookupAllHostAddr` which may do some resolving


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message