From 614ad95fbbb7d9f94369a722cb7f557286293fc5 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 --- api/client/service/list.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/client/service/list.go b/api/client/service/list.go index 2db36e44fd..95ab067055 100644 --- a/api/client/service/list.go +++ b/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{}{} } }