@Test public void hasCapacity() { assertTrue(capacity.hasCapacity(host1, resources1)); assertTrue(capacity.hasCapacity(host1, resources2)); assertTrue(capacity.hasCapacity(host2, resources1)); assertTrue(capacity.hasCapacity(host2, resources2)); assertFalse(capacity.hasCapacity(host3, resources1)); assertFalse(capacity.hasCapacity(host3, resources2)); Node nodeF = Node.createDockerNode(Set.of("::6"), "nodeF", "host1", resources1, NodeType.tenant); nodes.add(nodeF); capacity = new HostCapacity(new LockedNodeList(nodes, () -> {}), hostResourcesCalculator); assertFalse(capacity.hasCapacity(host1, resources1)); assertFalse(capacity.hasCapacity(host1, resources2)); }
boolean hasCapacity(Node dockerHost, NodeResources requestedCapacity) { return freeCapacityOf(dockerHost, false).satisfies(requestedCapacity) && freeIPs(dockerHost) > 0; }
HostCapacity { boolean hasCapacity(Node dockerHost, NodeResources requestedCapacity) { return freeCapacityOf(dockerHost, false).satisfies(requestedCapacity) && freeIPs(dockerHost) > 0; } }
HostCapacity { boolean hasCapacity(Node dockerHost, NodeResources requestedCapacity) { return freeCapacityOf(dockerHost, false).satisfies(requestedCapacity) && freeIPs(dockerHost) > 0; } HostCapacity(NodeList allNodes, HostResourcesCalculator hostResourcesCalculator); }
HostCapacity { boolean hasCapacity(Node dockerHost, NodeResources requestedCapacity) { return freeCapacityOf(dockerHost, false).satisfies(requestedCapacity) && freeIPs(dockerHost) > 0; } HostCapacity(NodeList allNodes, HostResourcesCalculator hostResourcesCalculator); NodeList allNodes(); Set<Node> findSpareHosts(List<Node> candidates, int count); NodeResources freeCapacityOf(Node host); }
HostCapacity { boolean hasCapacity(Node dockerHost, NodeResources requestedCapacity) { return freeCapacityOf(dockerHost, false).satisfies(requestedCapacity) && freeIPs(dockerHost) > 0; } HostCapacity(NodeList allNodes, HostResourcesCalculator hostResourcesCalculator); NodeList allNodes(); Set<Node> findSpareHosts(List<Node> candidates, int count); NodeResources freeCapacityOf(Node host);  }