Skip to content

Commit

Permalink
Alloc error message when no nodes are in DC
Browse files Browse the repository at this point in the history
  • Loading branch information
dadgar committed Dec 22, 2015
1 parent bcb2ef0 commit e54460c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scheduler/generic_sched.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ func (s *GenericScheduler) computePlacements(place []allocTuple) error {
return err
}

// Specialize the failure message if no nodes are ready in the datacenter.
failedMsg := "failed to find a node for placement"
if len(nodes) == 0 {
failedMsg = fmt.Sprintf("no nodes ready in datacenters: %v", s.job.Datacenters)
}

// Update the set of placement ndoes
s.stack.SetNodes(nodes)

Expand Down Expand Up @@ -293,7 +299,7 @@ func (s *GenericScheduler) computePlacements(place []allocTuple) error {
s.plan.AppendAlloc(alloc)
} else {
alloc.DesiredStatus = structs.AllocDesiredStatusFailed
alloc.DesiredDescription = "failed to find a node for placement"
alloc.DesiredDescription = failedMsg
alloc.ClientStatus = structs.AllocClientStatusFailed
alloc.TaskStates = initTaskState(missing.TaskGroup, structs.TaskStateDead)
s.plan.AppendFailed(alloc)
Expand Down

0 comments on commit e54460c

Please sign in to comment.