summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorJon Marius Venstad <jonmv@users.noreply.github.com>2018-09-05 08:53:55 +0200
committerGitHub <noreply@github.com>2018-09-05 08:53:55 +0200
commitdfb5dee44da940cb842700b403aab9f34614c7eb (patch)
tree5d0f51ff089540e004e80554539859a2a20c274b /controller-server
parent288ab8aae05915ec9a8c693b899be06a2cf74bab (diff)
parentf738e1621e0adf08047926ecec0917ae319e8667 (diff)
Merge pull request #6782 from vespa-engine/jvenstad/config-generation-details
Parse and expose config generation details
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java24
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java27
2 files changed, 41 insertions, 10 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java
index b49722f2f2d..67be4e829d8 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java
@@ -238,7 +238,7 @@ public class InternalStepRunner implements StepRunner {
ApplicationVersion application = setTheStage ? versions.sourceApplication().orElse(versions.targetApplication()) : versions.targetApplication();
logger.log("Checking installation of " + platform + " and " + application.id() + " ...");
- if (nodesConverged(id.application(), id.type(), platform, logger) && servicesConverged(id.application(), id.type())) {
+ if (nodesConverged(id.application(), id.type(), platform, logger) && servicesConverged(id.application(), id.type(), logger)) {
logger.log("Installation succeeded!");
return Optional.of(running);
}
@@ -260,7 +260,7 @@ public class InternalStepRunner implements StepRunner {
}
logger.log("Checking installation of tester container ...");
- if (servicesConverged(JobController.testerOf(id.application()), id.type())) {
+ if (servicesConverged(JobController.testerOf(id.application()), id.type(), logger)) {
logger.log("Tester container successfully installed!");
return Optional.of(running);
}
@@ -291,11 +291,21 @@ public class InternalStepRunner implements StepRunner {
&& node.rebootGeneration() == node.wantedRebootGeneration());
}
- private boolean servicesConverged(ApplicationId id, JobType type) {
- // TODO jvenstad: Print information for each host.
- return controller.configServer().serviceConvergence(new DeploymentId(id, type.zone(controller.system())))
- .map(ServiceConvergence::converged)
- .orElse(false);
+ private boolean servicesConverged(ApplicationId id, JobType type, DualLogger logger) {
+ Optional<ServiceConvergence> convergence = controller.configServer().serviceConvergence(new DeploymentId(id, type.zone(controller.system())));
+ if ( ! convergence.isPresent()) {
+ logger.log("Config status not currently available -- will retry.");
+ return false;
+ }
+ logger.log("Wanted config generation is " + convergence.get().wantedGeneration());
+ for (ServiceConvergence.Status serviceStatus : convergence.get().services())
+ if (serviceStatus.currentGeneration() != convergence.get().wantedGeneration())
+ logger.log(String.format("%70s: %11s on port %4d has %s",
+ serviceStatus.host().value(),
+ serviceStatus.type(),
+ serviceStatus.port(),
+ serviceStatus.currentGeneration() == -1 ? "(unknown)" : Long.toString(serviceStatus.currentGeneration())));
+ return convergence.get().converged();
}
private Optional<RunStatus> startTests(RunId id, DualLogger logger) {
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java
index dc9f3246e80..458ba49f3e3 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java
@@ -110,7 +110,17 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
/** Converge all services belonging to the given application */
public void convergeServices(ApplicationId application, ZoneId zone) {
- serviceStatus.put(new DeploymentId(application, zone), new ServiceConvergence(application, zone, true));
+ List<Node> nodes = nodeRepository.list(zone, application);
+ serviceStatus.put(new DeploymentId(application, zone), new ServiceConvergence(application,
+ zone,
+ true,
+ 2,
+ nodes.stream()
+ .map(node -> new ServiceConvergence.Status(node.hostname(),
+ 43,
+ "container",
+ 2))
+ .collect(Collectors.toList())));
}
/** The version given in the previous prepare call, or empty if no call has been made */
@@ -189,14 +199,24 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
public PrepareResponse prepareResponse() {
Application application = applications.get(deployment.applicationId());
application.activate();
- for (Node node : nodeRepository.list(deployment.zoneId(), deployment.applicationId())) {
+ List<Node> nodes = nodeRepository.list(deployment.zoneId(), deployment.applicationId());
+ for (Node node : nodes) {
nodeRepository.putByHostname(deployment.zoneId(), new Node(node.hostname(),
node.state(), node.type(),
node.owner(),
node.currentVersion(),
application.version().get()));
}
- serviceStatus.remove(deployment); // Deployment is no longer converging after new deployment
+ serviceStatus.put(deployment, new ServiceConvergence(deployment.applicationId(),
+ deployment.zoneId(),
+ false,
+ 2,
+ nodes.stream()
+ .map(node -> new ServiceConvergence.Status(node.hostname(),
+ 43,
+ "container",
+ 1))
+ .collect(Collectors.toList())));
PrepareResponse prepareResponse = new PrepareResponse();
prepareResponse.message = "foo";
@@ -223,6 +243,7 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
applications.remove(deployment.applicationId());
nodeRepository().removeByHostname(deployment.zoneId(),
nodeRepository().list(deployment.zoneId(), deployment.applicationId()));
+ serviceStatus.remove(deployment);
}
// Returns a canned example response