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 <aaron.lehmann@docker.com>
This commit is contained in:
parent
95ede360e8
commit
614ad95fbb
|
@ -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) {
|
func PrintNotQuiet(out io.Writer, services []swarm.Service, nodes []swarm.Node, tasks []swarm.Task) {
|
||||||
activeNodes := make(map[string]struct{})
|
activeNodes := make(map[string]struct{})
|
||||||
for _, n := range nodes {
|
for _, n := range nodes {
|
||||||
if n.Status.State == swarm.NodeStateReady {
|
if n.Status.State != swarm.NodeStateDown {
|
||||||
activeNodes[n.ID] = struct{}{}
|
activeNodes[n.ID] = struct{}{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue