@Override public void appendConstraints(AllocationAttempt attempt, AllocationLog log, List<Constraint> constraints) { for (Instance instance : attempt.getInstances()) { String networkMode = DataAccessor.fields(instance).withKey(DockerInstanceConstants.FIELD_NETWORK_MODE).as(String.class); if (NetworkConstants.NETWORK_MODE_CONTAINER.equals(networkMode) && instance.getNetworkContainerId() != null) { Long containerId = instance.getNetworkContainerId(); Set<Long> containerIds = new HashSet<Long>(); containerIds.add(containerId); Map<Long, Set<Long>> hostsToInstances = checkAndGetCollocatedInstanceHosts(containerIds, attempt.getInstances()); for (Map.Entry<Long, Set<Long>> hostToInstances : hostsToInstances.entrySet()) { constraints.add(new CollocationConstraint(hostToInstances.getKey(), hostToInstances.getValue())); } } } }
protected void waitForDependenciesStart(Instance instance) { List<Long> instancesIds = DataAccessor.fieldLongList(instance, DockerInstanceConstants.FIELD_VOLUMES_FROM); Long networkFromId = instance.getNetworkContainerId(); if (networkFromId != null) { instancesIds.add(networkFromId);
setExternalId(from.getExternalId()); setNativeContainer(from.getNativeContainer()); setNetworkContainerId(from.getNetworkContainerId()); setHealthState(from.getHealthState()); setStartCount(from.getStartCount());