Unverified Commit b6c35859 authored by Alex Dadgar's avatar Alex Dadgar Committed by GitHub
Browse files

Merge pull request #4048 from hashicorp/f-system

Correct status desc on draining system allocs
parents 24a1f60e 95c3c637
Showing with 11 additions and 11 deletions
+11 -11
......@@ -35,6 +35,10 @@ const (
// allocInPlace is the status used when speculating on an in-place update
allocInPlace = "alloc updating in-place"
// allocNodeTainted is the status used when stopping an alloc because it's
// node is tainted.
allocNodeTainted = "alloc not needed as node is tainted"
// blockedEvalMaxPlanDesc is the description used for blocked evals that are
// a result of hitting the max number of plan attempts
blockedEvalMaxPlanDesc = "created due to placement conflicts"
......
......@@ -14,10 +14,6 @@ const (
// we will attempt to schedule if we continue to hit conflicts for system
// jobs.
maxSystemScheduleAttempts = 5
// allocNodeTainted is the status used when stopping an alloc because it's
// node is tainted.
allocNodeTainted = "alloc not needed as node is tainted"
)
// SystemScheduler is used for 'system' jobs. This scheduler is
......@@ -212,6 +208,11 @@ func (s *SystemScheduler) computeJobAllocs() error {
s.plan.AppendUpdate(e.Alloc, structs.AllocDesiredStatusStop, allocNotNeeded, "")
}
// Add all the allocs to migrate
for _, e := range diff.migrate {
s.plan.AppendUpdate(e.Alloc, structs.AllocDesiredStatusStop, allocNodeTainted, "")
}
// Lost allocations should be transitioned to desired status stop and client
// status lost.
for _, e := range diff.lost {
......
......@@ -214,11 +214,6 @@ func diffSystemAllocs(job *structs.Job, nodes []*structs.Node, taintedNodes map[
}
}
// Migrate does not apply to system jobs and instead should be marked as
// stop because if a node is tainted, the job is invalid on that node.
diff.stop = append(diff.stop, diff.migrate...)
diff.migrate = nil
result.Append(diff)
}
......
......@@ -265,12 +265,12 @@ func TestDiffSystemAllocs(t *testing.T) {
}
// We should stop the third alloc
if len(stop) != 1 || stop[0].Alloc != allocs[2] {
if len(stop) != 0 {
t.Fatalf("bad: %#v", stop)
}
// There should be no migrates.
if len(migrate) != 0 {
if len(migrate) != 1 || migrate[0].Alloc != allocs[2] {
t.Fatalf("bad: %#v", migrate)
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment