summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config-provisioning/abi-spec.json2
-rw-r--r--config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java12
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/DockerProvisioningTest.java26
3 files changed, 35 insertions, 5 deletions
diff --git a/config-provisioning/abi-spec.json b/config-provisioning/abi-spec.json
index 61cbc7da52d..4c1e6e3e08a 100644
--- a/config-provisioning/abi-spec.json
+++ b/config-provisioning/abi-spec.json
@@ -592,6 +592,7 @@
"public static com.yahoo.config.provision.NodeResources$DiskSpeed[] values()",
"public static com.yahoo.config.provision.NodeResources$DiskSpeed valueOf(java.lang.String)",
"public static int compare(com.yahoo.config.provision.NodeResources$DiskSpeed, com.yahoo.config.provision.NodeResources$DiskSpeed)",
+ "public boolean compatibleWith(com.yahoo.config.provision.NodeResources$DiskSpeed)",
"public boolean isDefault()",
"public static com.yahoo.config.provision.NodeResources$DiskSpeed getDefault()"
],
@@ -613,6 +614,7 @@
"public static com.yahoo.config.provision.NodeResources$StorageType[] values()",
"public static com.yahoo.config.provision.NodeResources$StorageType valueOf(java.lang.String)",
"public static int compare(com.yahoo.config.provision.NodeResources$StorageType, com.yahoo.config.provision.NodeResources$StorageType)",
+ "public boolean compatibleWith(com.yahoo.config.provision.NodeResources$StorageType)",
"public boolean isDefault()",
"public static com.yahoo.config.provision.NodeResources$StorageType getDefault()"
],
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java
index 7769060dc60..ce3dd579d2f 100644
--- a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java
+++ b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java
@@ -29,6 +29,10 @@ public class NodeResources {
return 0;
}
+ public boolean compatibleWith(DiskSpeed other) {
+ return this == any || other == any || other == this;
+ }
+
private DiskSpeed combineWith(DiskSpeed other) {
if (this == any) return other;
if (other == any) return this;
@@ -60,6 +64,10 @@ public class NodeResources {
return 0;
}
+ public boolean compatibleWith(StorageType other) {
+ return this == any || other == any || other == this;
+ }
+
private StorageType combineWith(StorageType other) {
if (this == any) return other;
if (other == any) return this;
@@ -218,8 +226,8 @@ public class NodeResources {
if (this.memoryGb != other.memoryGb) return false;
if (this.diskGb != other.diskGb) return false;
if (this.bandwidthGbps != other.bandwidthGbps) return false;
- if (other.diskSpeed != DiskSpeed.any && other.diskSpeed != this.diskSpeed) return false;
- if (other.storageType != StorageType.any && other.storageType != this.storageType) return false;
+ if ( ! this.diskSpeed.compatibleWith(other.diskSpeed)) return false;
+ if ( ! this.storageType.compatibleWith(other.storageType)) return false;
return true;
}
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/DockerProvisioningTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/DockerProvisioningTest.java
index 3ca159e10eb..b731ab309a6 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/DockerProvisioningTest.java
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/DockerProvisioningTest.java
@@ -11,6 +11,7 @@ import com.yahoo.config.provision.HostSpec;
import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.NodeResources;
import com.yahoo.config.provision.NodeType;
+import com.yahoo.config.provision.OutOfCapacityException;
import com.yahoo.config.provision.ParentHostUnavailableException;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.Zone;
@@ -36,7 +37,8 @@ import static org.junit.Assert.fail;
*/
public class DockerProvisioningTest {
- private static final NodeResources dockerFlavor = new NodeResources(1, 4, 10, 1);
+ private static final NodeResources dockerFlavor = new NodeResources(1, 4, 10, 1,
+ NodeResources.DiskSpeed.fast, NodeResources.StorageType.local);
@Test
public void docker_application_deployment() {
@@ -204,7 +206,7 @@ public class DockerProvisioningTest {
}
catch (Exception e) {
assertEquals("No room for 3 nodes as 2 of 4 hosts are exclusive",
- "Could not satisfy request for 3 nodes with [vcpu: 1.0, memory: 4.0 Gb, disk 10.0 Gb, bandwidth: 1.0 Gbps] for container cluster 'myContainer' group 0 6.39 in tenant1.app1: Not enough nodes available due to host exclusivity constraints.",
+ "Could not satisfy request for 3 nodes with [vcpu: 1.0, memory: 4.0 Gb, disk 10.0 Gb, bandwidth: 1.0 Gbps, storage type: local] for container cluster 'myContainer' group 0 6.39 in tenant1.app1: Not enough nodes available due to host exclusivity constraints.",
e.getMessage());
}
@@ -225,7 +227,25 @@ public class DockerProvisioningTest {
NodeList nodes = tester.getNodes(application1, Node.State.active);
assertEquals(1, nodes.size());
- assertEquals("[vcpu: 1.0, memory: 4.0 Gb, disk 10.0 Gb, bandwidth: 1.0 Gbps]", nodes.asList().get(0).flavor().name());
+ assertEquals("[vcpu: 1.0, memory: 4.0 Gb, disk 10.0 Gb, bandwidth: 1.0 Gbps, storage type: local]", nodes.asList().get(0).flavor().name());
+ }
+
+ @Test
+ public void storage_type_must_match() {
+ try {
+ ProvisioningTester tester = new ProvisioningTester.Builder()
+ .zone(new Zone(Environment.prod, RegionName.from("us-east-1"))).build();
+ ApplicationId application1 = tester.makeApplicationId();
+ tester.makeReadyVirtualDockerNodes(1, dockerFlavor, "dockerHost1");
+ tester.makeReadyVirtualDockerNodes(1, dockerFlavor, "dockerHost2");
+
+ List<HostSpec> hosts = tester.prepare(application1, ClusterSpec.request(ClusterSpec.Type.content, ClusterSpec.Id.from("myContent"),
+ Version.fromString("6.42"), false), 2, 1,
+ dockerFlavor.with(NodeResources.StorageType.remote));
+ }
+ catch (OutOfCapacityException e) {
+ assertTrue(e.getMessage().startsWith("Could not satisfy request for 2 nodes with [vcpu: 1.0, memory: 4.0 Gb, disk 10.0 Gb, bandwidth: 1.0 Gbps, storage type: remote]"));
+ }
}
private Set<String> hostsOf(NodeList nodes) {