From 222730f5ff40dd66a349662c88c64548446a27a4 Mon Sep 17 00:00:00 2001 From: toby Date: Wed, 14 Feb 2018 15:24:54 +0100 Subject: Remove unused code, move out static strings --- .../hosted/node/admin/docker/DockerOperationsImpl.java | 13 +++++-------- .../hosted/node/admin/docker/NetworkPrefixTranslator.java | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImpl.java index 96cde6f9f64..b30cac2476e 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImpl.java @@ -45,6 +45,9 @@ public class DockerOperationsImpl implements DockerOperations { private static final String MANAGER_NAME = "node-admin"; + private static final String LOCAL_IPV6_PREFIX = "fd00::"; + private static final String DOCKER_CUSTOM_BRIDGE_NETWORK_NAME = "vespa-bridge"; + // Map of directories to mount and whether they should be writable by everyone private static final Map DIRECTORIES_TO_MOUNT = new HashMap<>(); @@ -121,17 +124,15 @@ public class DockerOperationsImpl implements DockerOperations { .withAddCapability("SYS_ADMIN"); // Needed for perf if (!docker.networkNPTed()) { - logger.info("Network is macvlan - setting up container with public ip address on a macvlan"); command.withIpAddress(nodeInetAddress); command.withNetworkMode(DockerImpl.DOCKER_CUSTOM_MACVLAN_NETWORK_NAME); command.withVolume("/etc/hosts", "/etc/hosts"); // TODO This is probably not nessesary - review later } else { - logger.info("Network is NPTed - setting up container with private ip address"); command.withIpAddress(NetworkPrefixTranslator.translate( nodeInetAddress, - InetAddress.getByName("fd00::"), + InetAddress.getByName(LOCAL_IPV6_PREFIX), 64)); - command.withNetworkMode("vespa-bridge"); + command.withNetworkMode(DOCKER_CUSTOM_BRIDGE_NETWORK_NAME); } for (String pathInNode : DIRECTORIES_TO_MOUNT.keySet()) { @@ -168,10 +169,6 @@ public class DockerOperationsImpl implements DockerOperations { } } - private InetAddress toPrivateSubnet(InetAddress nodeInetAddress) { - return null; - } - @Override public void removeContainer(final Container existingContainer, ContainerNodeSpec nodeSpec) { final ContainerName containerName = existingContainer.name; diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/NetworkPrefixTranslator.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/NetworkPrefixTranslator.java index 70c58def24f..a52dedb90e5 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/NetworkPrefixTranslator.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/NetworkPrefixTranslator.java @@ -16,7 +16,7 @@ class NetworkPrefixTranslator { * * @param address The original address to translate * @param prefix The prefix address - * @param subnetSize nof bits - e.g /64 subnet is 64 + * @param subnetSize in bits - e.g a /64 subnet equals 64 bits * @return The translated address */ static Inet6Address translate(InetAddress address, InetAddress prefix, int subnetSize) { -- cgit v1.2.3