diff options
author | Håkon Hallingstad <hakon@verizonmedia.com> | 2020-11-26 15:22:19 +0100 |
---|---|---|
committer | Håkon Hallingstad <hakon@verizonmedia.com> | 2020-11-26 15:22:19 +0100 |
commit | d6e727e30087e321911aa240fee03053cc22b1f4 (patch) | |
tree | f20b90d16103704adcad2085a6084252ef826fc8 /flags/src/test/java/com/yahoo | |
parent | c1303724a101117e5c7cbf0d3ff9997705c01033 (diff) |
Allow preprovision capacity on partially filled hosts
Adds new functionality that can be disabled by setting the
compact-preprovision-capacity flag to false.
preprovision-capacity can be satisfied by hosts with spare resources. The
DynamicProvisioningMaintainer does this as follows:
1. For each cluster in preprovision-capacity, try to
a. allocate the cluster using NodePrioritizer
b. If there is a deficit, provision the deficit with HostProvisioner, which
may provision larger shared hosts depending on shared-hosts, and retry
(1) from the first cluster again.
c. Otherwise, pretend the nodes are allocated and go to next cluster.
2. All of preprovision-capacity was successfully allocated, and empty hosts
are therefore excess that can be deprovisioned.
Diffstat (limited to 'flags/src/test/java/com/yahoo')
-rw-r--r-- | flags/src/test/java/com/yahoo/vespa/flags/custom/ClusterCapacityTest.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/flags/src/test/java/com/yahoo/vespa/flags/custom/ClusterCapacityTest.java b/flags/src/test/java/com/yahoo/vespa/flags/custom/ClusterCapacityTest.java new file mode 100644 index 00000000000..0258b562897 --- /dev/null +++ b/flags/src/test/java/com/yahoo/vespa/flags/custom/ClusterCapacityTest.java @@ -0,0 +1,41 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.flags.custom; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.Test; + +import java.io.IOException; + +import static org.junit.Assert.assertEquals; + +public class ClusterCapacityTest { + @Test + public void serialization() throws IOException { + ClusterCapacity clusterCapacity = new ClusterCapacity(7, 1.2, 3.4, 5.6, null); + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(clusterCapacity); + assertEquals("{\"count\":7,\"vcpu\":1.2,\"memoryGb\":3.4,\"diskGb\":5.6}", json); + + ClusterCapacity deserialized = mapper.readValue(json, ClusterCapacity.class); + assertEquals(1.2, deserialized.vcpu(), 0.0001); + assertEquals(3.4, deserialized.memoryGb(), 0.0001); + assertEquals(5.6, deserialized.diskGb(), 0.0001); + assertEquals(1.0, deserialized.bandwidthGbps(), 0.0001); + assertEquals(7, deserialized.count()); + } + + @Test + public void serialization2() throws IOException { + ClusterCapacity clusterCapacity = new ClusterCapacity(7, 1.2, 3.4, 5.6, 2.3); + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(clusterCapacity); + assertEquals("{\"count\":7,\"vcpu\":1.2,\"memoryGb\":3.4,\"diskGb\":5.6,\"bandwidthGbps\":2.3}", json); + + ClusterCapacity deserialized = mapper.readValue(json, ClusterCapacity.class); + assertEquals(1.2, deserialized.vcpu(), 0.0001); + assertEquals(3.4, deserialized.memoryGb(), 0.0001); + assertEquals(5.6, deserialized.diskGb(), 0.0001); + assertEquals(2.3, deserialized.bandwidthGbps(), 0.0001); + assertEquals(7, deserialized.count()); + } +}
\ No newline at end of file |