1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

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:
Aaron Lehmann 2016-07-28 11:44:28 -07:00
parent 95ede360e8
commit 614ad95fbb

View file

@ -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{}{}
} }
} }