Skip to content

Commit

Permalink
switch to alloc ID in CSIVolume.Claim request
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross committed Feb 19, 2020
1 parent 7e0faf4 commit a4a4b75
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion jobspec/test-fixtures/service-enable-tag-override.hcl
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
job "service_eto" {
type = "service"

group "group" {
task "task" {
service {
name = "example"
name = "example"
enable_tag_override = true
}
}
Expand Down
2 changes: 1 addition & 1 deletion jobspec/test-fixtures/tg-service-enable-tag-override.hcl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
job "group_service_eto" {
group "group" {
service {
name = "example"
name = "example"
enable_tag_override = true
}
}
Expand Down
14 changes: 7 additions & 7 deletions nomad/core_sched.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ func (c *CoreScheduler) volumeClaimReap(jobs []*structs.Job, leaderACL string) e
continue
}

gcAllocs := []*structs.Allocation{}
gcAllocs := []string{} // alloc IDs
claimedNodes := map[string]struct{}{}
knownNodes := []string{}

Expand All @@ -790,17 +790,17 @@ func (c *CoreScheduler) volumeClaimReap(jobs []*structs.Job, leaderACL string) e
claimedNodes[alloc.NodeID] = struct{}{}
continue
}
gcAllocs = append(gcAllocs, alloc)
gcAllocs = append(gcAllocs, alloc.ID)
}
}

collectFunc(vol.WriteAllocs)
collectFunc(vol.ReadAllocs)

req := &structs.CSIVolumeClaimRequest{
VolumeID: volID,
Allocation: nil, // controller unpublish never uses this field
Claim: structs.CSIVolumeClaimRelease,
VolumeID: volID,
AllocationID: "", // controller unpublish never uses this field
Claim: structs.CSIVolumeClaimRelease,
WriteRequest: structs.WriteRequest{
Region: job.Region,
Namespace: job.Namespace,
Expand All @@ -822,8 +822,8 @@ func (c *CoreScheduler) volumeClaimReap(jobs []*structs.Job, leaderACL string) e
}
}

for _, alloc := range gcAllocs {
req.Allocation = alloc
for _, allocID := range gcAllocs {
req.AllocationID = allocID
err = c.srv.RPC("CSIVolume.Claim", req, &structs.CSIVolumeClaimResponse{})
if err != nil {
c.logger.Error("volume claim release failed", "error", err)
Expand Down

0 comments on commit a4a4b75

Please sign in to comment.