summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-06-27 14:35:56 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-06-27 14:35:56 +0200
commit6d54cff8aa96d946c04af5c6591cb9452b318fd4 (patch)
tree85a5ca3d33191dc706bdad3033ae1ff595fece49 /config-model
parent6701d0e82cc70a360d56eedf8e441ee930af8128 (diff)
Move content cluster building into Content
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomContainerClusterBuilder.java1
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomContentBuilder.java4
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/Content.java8
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java6
4 files changed, 14 insertions, 5 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomContainerClusterBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomContainerClusterBuilder.java
index fe339835c78..bfbff219653 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomContainerClusterBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomContainerClusterBuilder.java
@@ -106,4 +106,5 @@ public abstract class DomContainerClusterBuilder<CLUSTER extends ContainerCluste
protected void buildAndAddProcessingRenderers(ContainerCluster cluster, Element spec) {
ContainerModelBuilder.addConfiguredComponents(cluster, spec, "renderer");
}
+
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomContentBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomContentBuilder.java
index aecd0f9efb5..f427bfbc575 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomContentBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomContentBuilder.java
@@ -32,9 +32,7 @@ public class DomContentBuilder extends ConfigModelBuilder<Content> {
@Override
public void doBuild(Content content, Element xml, ConfigModelContext modelContext) {
- Admin admin = content.adminModel() != null ? content.adminModel().getAdmin() : null; // This is null in tests only
- ContentCluster cluster = new ContentCluster.Builder(admin, modelContext.getDeployLogger()).build(modelContext.getParentProducer(), xml);
- content.setCluster(cluster, modelContext);
+ content.build(xml, modelContext);
}
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/Content.java b/config-model/src/main/java/com/yahoo/vespa/model/content/Content.java
index 4bb0144ed0c..3b52a5a3bfb 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/Content.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/Content.java
@@ -15,6 +15,7 @@ import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.config.model.producer.AbstractConfigProducerRoot;
import com.yahoo.log.LogLevel;
import com.yahoo.vespa.model.*;
+import com.yahoo.vespa.model.admin.Admin;
import com.yahoo.vespa.model.builder.VespaModelBuilder;
import com.yahoo.vespa.model.builder.xml.dom.VespaDomBuilder;
import com.yahoo.vespa.model.container.Container;
@@ -29,6 +30,7 @@ import com.yahoo.vespa.model.search.AbstractSearchCluster;
import com.yahoo.vespa.model.search.IndexedSearchCluster;
import com.yahoo.vespa.model.search.IndexingDocprocChain;
import com.yahoo.vespa.model.search.SearchNode;
+import org.w3c.dom.Element;
import java.util.*;
import java.util.logging.Logger;
@@ -64,8 +66,9 @@ public class Content extends ConfigModel {
public AdminModel adminModel() { return adminModel; }
/** Called by DomContentBuilder during build */
- public void setCluster(ContentCluster cluster, ConfigModelContext configModelContext) {
- this.cluster = cluster;
+ public void build(Element xml, ConfigModelContext configModelContext) {
+ Admin admin = adminModel() != null ? adminModel().getAdmin() : null; // This is null in tests only
+ cluster = new ContentCluster.Builder(admin, configModelContext.getDeployLogger()).build(configModelContext.getParentProducer(), xml);
initializeIndexingClusters(containers,
configModelContext.getConfigModelRepoAdder(),
(ApplicationConfigProducerRoot)configModelContext.getParentProducer());
@@ -343,5 +346,6 @@ public class Content extends ConfigModel {
// Currently only distribute affinity for search nodes
AbstractService.distributeCpuSocketAffinity(cluster.getSearch().getSearchNodes());
}
+
}
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 08685659d35..052fc1487e2 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
@@ -314,11 +314,17 @@ public class ContentCluster extends AbstractConfigProducer implements StorDistri
private List<HostResource> drawContentHosts(int count, StorageGroup rootGroup) {
List<HostResource> hosts = drawContentHostsRecursively(count, rootGroup);
+ if (hosts.size() < 3) // supply with containers if we don't have enough content hosts
+ hosts.addAll(drawContainerHosts(3 - hosts.size()));
if (hosts.size() % 2 == 0) // ZK clusters of even sizes are less available (even in the size=2 case)
hosts = hosts.subList(0, hosts.size()-1);
return hosts;
}
+ private List<HostResource> drawContainerHosts(int count) {
+ return new ArrayList<>(); // TODO
+ }
+
/**
* Draw <code>count</code> nodes from as many different content groups below this as possible.
* This will only achieve maximum spread in the case where the groups are balanced and never on the same