// Perform runs the Step action to modify the Cluster func (step AddNode) prioritizeCellsByHealth(existingNodes []*structs.Node, cells cells.Cells) (cellsToTry cells.Cells, err error) { // Prioritize availableCells into [unused AZs, used AZs, used cells] health, err := cells.InspectHealth() if err != nil { return } vs := utils.NewValSorter(health) vs.Sort() for _, nextCellID := range vs.Keys { for _, cellAPI := range cells { if cellAPI.GUID == nextCellID { cellsToTry = append(cellsToTry, cellAPI) break } } } return }