Quellcode durchsuchen

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>
Aaron Lehmann vor 9 Jahren
Ursprung
Commit
614ad95fbb
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
  1. 1 1
      api/client/service/list.go

+ 1 - 1
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) {
 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{}{}
 		}
 		}
 	}
 	}