From a867691c0efa28a7a055773178e0f63a0b1d0c7c Mon Sep 17 00:00:00 2001 From: Aaron Lehmann Date: Thu, 28 Jul 2016 11:44:28 -0700 Subject: [PATCH] service ls: Show tasks from nodes that are not down, not only "ready" nodes Currently, the counter only shows tasks on READY nodes. It's more correct to also count nodes in the other states except DOWN, because the tasks assocated with those nodes are still assumed to be running for orchestration purposes. One example of when this could matter is during a leader failover when agents are in the process of reconnecting. Signed-off-by: Aaron Lehmann Upstream-commit: 614ad95fbbb7d9f94369a722cb7f557286293fc5 Component: engine --- components/engine/api/client/service/list.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/api/client/service/list.go b/components/engine/api/client/service/list.go index 2db36e44fd..95ab067055 100644 --- a/components/engine/api/client/service/list.go +++ b/components/engine/api/client/service/list.go @@ -84,7 +84,7 @@ func runList(dockerCli *client.DockerCli, opts listOptions) error { func PrintNotQuiet(out io.Writer, services []swarm.Service, nodes []swarm.Node, tasks []swarm.Task) { activeNodes := make(map[string]struct{}) for _, n := range nodes { - if n.Status.State == swarm.NodeStateReady { + if n.Status.State != swarm.NodeStateDown { activeNodes[n.ID] = struct{}{} } }