aboutsummaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2017-06-22 10:46:36 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2017-06-22 10:46:36 +0200
commite0a11cbca7ac6073d8e79d1d2b0f2d5d0d583a8f (patch)
tree5ebcc7042c4ede6dcd9f82ac32df54ef7c86185e /config-model
parenta69299eb06d514e77394248d5dbdcfc52a3f09d6 (diff)
Remove ip lookup
This was not really necessary and caused the vm to hang on Docker on Mac.
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/test/MockRoot.java1
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/Host.java25
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/HostSystem.java28
3 files changed, 11 insertions, 43 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/test/MockRoot.java b/config-model/src/main/java/com/yahoo/config/model/test/MockRoot.java
index a2955676d1f..277e02e43e2 100644
--- a/config-model/src/main/java/com/yahoo/config/model/test/MockRoot.java
+++ b/config-model/src/main/java/com/yahoo/config/model/test/MockRoot.java
@@ -40,7 +40,6 @@ import java.util.Set;
public class MockRoot extends AbstractConfigProducerRoot {
private static final long serialVersionUID = 1L;
- public static final String MOCKHOST = "mockhost";
private HostSystem hostSystem;
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/Host.java b/config-model/src/main/java/com/yahoo/vespa/model/Host.java
index aecc6a02b62..27d5991154c 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/Host.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/Host.java
@@ -36,25 +36,22 @@ public final class Host extends AbstractConfigProducer<AbstractConfigProducer<?>
Objects.requireNonNull(hostname, "The host name of a host cannot be null");
this.runsConfigServer = runsConfigServer;
this.hostname = hostname;
- if (parent instanceof HostSystem) {
+ if (parent instanceof HostSystem)
checkName((HostSystem) parent, hostname);
- }
}
private void checkName(HostSystem parent, String hostname) {
// Give a warning if the host does not exist
- if (! parent.getIp(hostname).equals("0.0.0.0")) {
- // Host exists - warn if given hostname is not a fully qualified one.
- String canonical=hostname;
- try {
- canonical = parent.getCanonicalHostname(hostname);
- } catch (UnknownHostException e) {
- deployLogger().log(Level.WARNING, "Unable to find canonical hostname of host: " + hostname);
- }
- if ((null != canonical) && (! hostname.equals(canonical))) {
- deployLogger().log(Level.WARNING, "Host named '" + hostname + "' will not receive any config " +
- "since it does not match its canonical hostname: " + canonical);
- }
+ // Host exists - warn if given hostname is not a fully qualified one.
+ String canonical = hostname;
+ try {
+ canonical = parent.getCanonicalHostname(hostname);
+ } catch (UnknownHostException e) {
+ deployLogger().log(Level.WARNING, "Unable to find canonical hostname of host: " + hostname);
+ }
+ if ((null != canonical) && (! hostname.equals(canonical))) {
+ deployLogger().log(Level.WARNING, "Host named '" + hostname + "' will not receive any config " +
+ "since it does not match its canonical hostname: " + canonical);
}
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/HostSystem.java b/config-model/src/main/java/com/yahoo/vespa/model/HostSystem.java
index e8aacf20564..2db9b6acece 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/HostSystem.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/HostSystem.java
@@ -4,14 +4,12 @@ package com.yahoo.vespa.model;
import com.yahoo.config.application.api.DeployLogger;
import com.yahoo.config.model.api.HostProvisioner;
import com.yahoo.config.model.producer.AbstractConfigProducer;
-import com.yahoo.config.model.test.MockRoot;
import com.yahoo.config.provision.Capacity;
import com.yahoo.config.provision.ClusterMembership;
import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.HostSpec;
import com.yahoo.config.provision.ProvisionLogger;
-import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Collections;
import java.util.LinkedHashMap;
@@ -36,7 +34,6 @@ public class HostSystem extends AbstractConfigProducer<Host> {
private static Logger log = Logger.getLogger(HostSystem.class.getName());
- private Map<String,String> ipAddresses = new LinkedHashMap<>();
private Map<String,String> hostnames = new LinkedHashMap<>();
private final Map<String, HostResource> hostname2host = new LinkedHashMap<>();
@@ -91,31 +88,6 @@ public class HostSystem extends AbstractConfigProducer<Host> {
return java.net.InetAddress.getByName(hostname).getCanonicalHostName();
}
- /**
- * Returns the if address of a host.
- *
- * @param hostname the hostname to retrieve the ip address for.
- * @return The string representation of the ip-address.
- */
- public String getIp(String hostname) {
- if (ipAddresses.containsKey(hostname)) return ipAddresses.get(hostname);
-
- String ipAddress;
- if (hostname.startsWith(MockRoot.MOCKHOST)) { // TODO: Remove
- ipAddress = "0.0.0.0";
- } else {
- try {
- InetAddress address = InetAddress.getByName(hostname);
- ipAddress = address.getHostAddress();
- } catch (java.net.UnknownHostException e) {
- log.warning("Unable to find valid IP address of host: " + hostname);
- ipAddress = "0.0.0.0";
- }
- }
- ipAddresses.put(hostname, ipAddress);
- return ipAddress;
- }
-
@Override
public String toString() {
StringBuilder sb = new StringBuilder();