diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2021-02-19 08:23:36 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2021-02-19 17:40:10 +0100 |
commit | 62cb446db592467db306a4af633a38d8e138150a (patch) | |
tree | 741dbed8331681f67b044ff5c717b2f1f7e5f426 | |
parent | 464a2195e2450cd8f1e08c7f0b9a1c22ab089b93 (diff) |
Rename, put CCC resources in field, add test model CCC switch
3 files changed, 15 insertions, 12 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 8e94a786b4c..4c5ec1cbbc8 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 @@ -190,8 +190,8 @@ public class NodesSpecification { * Returns a requirement for {@code count} nodes with {@code exclusive} and {@code required} taken as * the OR over all content clusters, and with the given resources. */ - public static NodesSpecification dedicatedFromSharedParents(int count, NodeResources resources, - ModelElement element, ConfigModelContext context) { + public static NodesSpecification exclusiveAndRequiredFromSharedParents(int count, NodeResources resources, + ModelElement element, ConfigModelContext context) { List<NodesSpecification> allContent = findParentByTag("services", element.getXml()).map(services -> XML.getChildren(services, "content")) .orElse(List.of()) .stream() diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java index 9d5eda672d5..993857a8e3f 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java @@ -351,18 +351,15 @@ public class ContentCluster extends AbstractConfigProducer implements return ! Sets.intersection(c1Hosts, c2Hosts).isEmpty(); } + public static final NodeResources clusterControllerResources = new NodeResources(0.5, 2, 10, 0.3, NodeResources.DiskSpeed.any, NodeResources.StorageType.any); + private ClusterControllerContainerCluster getDedicatedSharedControllers(ModelElement contentElement, Admin admin, ContentCluster contentCluster, ConfigModelContext context) { if (admin.getClusterControllers() == null) { - NodesSpecification spec = NodesSpecification.dedicatedFromSharedParents(3, - new NodeResources(0.5, - 2, - 10, - 0.3, - NodeResources.DiskSpeed.any, - NodeResources.StorageType.any), - contentElement, - context); + NodesSpecification spec = NodesSpecification.exclusiveAndRequiredFromSharedParents(3, + clusterControllerResources, + contentElement, + context); Collection<HostResource> hosts = spec.provision(admin.hostSystem(), ClusterSpec.Type.admin, diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTester.java b/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTester.java index 86522a56f11..e779b5e43cb 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTester.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTester.java @@ -55,6 +55,7 @@ public class VespaModelTester { private final Map<NodeResources, Collection<Host>> hostsByResources = new HashMap<>(); private ApplicationId applicationId = ApplicationId.defaultId(); private boolean useDedicatedNodeForLogserver = false; + private boolean dedicatedClusterControllerCluster = false; public VespaModelTester() { this(new NullConfigModelRegistry()); @@ -100,6 +101,10 @@ public class VespaModelTester { applicationId = ApplicationId.from(tenant, applicationName, instanceName); } + public void dedicatedClusterControllerCluster(boolean dedicatedClusterControllerCluster) { + this.dedicatedClusterControllerCluster = dedicatedClusterControllerCluster; + } + public void useDedicatedNodeForLogserver(boolean useDedicatedNodeForLogserver) { this.useDedicatedNodeForLogserver = useDedicatedNodeForLogserver; } @@ -156,7 +161,8 @@ public class VespaModelTester { .setMultitenant(true) .setHostedVespa(hosted) .setApplicationId(applicationId) - .setUseDedicatedNodeForLogserver(useDedicatedNodeForLogserver); + .setUseDedicatedNodeForLogserver(useDedicatedNodeForLogserver) + .setDedicatedClusterControllerCluster(dedicatedClusterControllerCluster); DeployState.Builder deployState = new DeployState.Builder() .applicationPackage(appPkg) |