// CellAZsByUnusednes sorts the availability zones in order of whether this cluster is using them or not // An AZ that is not being used at all will be early in the result. // All known AZs are included in the result func (step AddNode) sortCellAZsByUnusedness(existingNodes []*structs.Node, cells cells.Cells) (vs *utils.ValSorter) { azUsageData := map[string]int{} for _, az := range cells.AllAvailabilityZones() { azUsageData[az] = 0 } for _, existingNode := range existingNodes { if az, err := cells.AvailabilityZone(existingNode.CellGUID); err == nil { azUsageData[az] += 1 } } vs = utils.NewValSorter(azUsageData) vs.Sort() return }