summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2020-10-16 07:33:04 +0200
committerHarald Musum <musum@verizonmedia.com>2020-10-16 07:33:04 +0200
commitf1da5a48e0052671b100321c2ffad63b2f10cb13 (patch)
tree9201a776c13c5f270554a80440075c15acb2dffe /config-model
parent56f9d32c4d5ef275a128d8f5cb1025f7834ddd58 (diff)
Support 'exclusive' node attribute for content clusters
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java4
-rw-r--r--config-model/src/main/resources/schema/content.rnc1
-rw-r--r--config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java24
3 files changed, 27 insertions, 2 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java
index 8f737f02dca..526e88749fc 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java
@@ -36,10 +36,10 @@ public class NodesSpecification {
private final boolean dedicated;
/** The Vespa version we want the nodes to run */
- private Version version;
+ private final Version version;
/**
- * Whether the capacity amount specified is required or can it be relaxed
+ * Whether the capacity amount specified is required or can be relaxed
* at the discretion of the component fulfilling it
*/
private final boolean required;
diff --git a/config-model/src/main/resources/schema/content.rnc b/config-model/src/main/resources/schema/content.rnc
index 481d82ebb4b..5646bc72056 100644
--- a/config-model/src/main/resources/schema/content.rnc
+++ b/config-model/src/main/resources/schema/content.rnc
@@ -225,6 +225,7 @@ ContentNodes = element nodes {
attribute count { xsd:positiveInteger | xsd:string } &
attribute flavor { xsd:string }? &
attribute required { xsd:boolean }? &
+ attribute exclusive { xsd:boolean }? &
attribute docker-image { xsd:string }? &
attribute groups { xsd:positiveInteger | xsd:string }?
)
diff --git a/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java b/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java
index e3a53c8c4f1..02f8c7f420c 100644
--- a/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java
+++ b/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java
@@ -1142,6 +1142,30 @@ public class ModelProvisioningTest {
}
@Test
+ public void testExclusiveNodes() {
+ String services =
+ "<?xml version='1.0' encoding='utf-8' ?>\n" +
+ "<services>" +
+ "<container version='1.0' id='container'>" +
+ " <nodes count='2' exclusive='true'/>" +
+ " </container>" +
+ " <content version='1.0' id='bar'>" +
+ " <redundancy>1</redundancy>" +
+ " <documents>" +
+ " <document type='type1' mode='index'/>" +
+ " </documents>" +
+ " <nodes count='3' exclusive='true'/>" +
+ " </content>" +
+ "</services>";
+
+ int numberOfHosts = 5;
+ VespaModelTester tester = new VespaModelTester();
+ tester.addHosts(numberOfHosts);
+ VespaModel model = tester.createModel(services, false);
+ model.hostSystem().getHosts().forEach(host -> assertTrue(host.spec().membership().get().cluster().isExclusive()));
+ }
+
+ @Test
public void testUsingNodesCountAttributesAndGettingJustOneNode() {
String services =
"<?xml version='1.0' encoding='utf-8' ?>\n" +