From cebcb23b1a1fc3c7cab7e844bc34d3da30890fc7 Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Wed, 10 Mar 2021 16:24:01 -0500 Subject: [PATCH] add per-alloc renaming at client --- client/allocrunner/csi_hook.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/client/allocrunner/csi_hook.go b/client/allocrunner/csi_hook.go index 88eaddaecf8..76c65689313 100644 --- a/client/allocrunner/csi_hook.go +++ b/client/allocrunner/csi_hook.go @@ -92,8 +92,13 @@ func (c *csiHook) Postrun() error { mode = structs.CSIVolumeClaimWrite } + source := pair.request.Source + if pair.request.PerAlloc { + source = source + structs.AllocSuffix(c.alloc.Name) + } + req := &structs.CSIVolumeUnpublishRequest{ - VolumeID: pair.request.Source, + VolumeID: source, Claim: &structs.CSIVolumeClaim{ AllocationID: c.alloc.ID, NodeID: c.alloc.NodeID, @@ -159,8 +164,13 @@ func (c *csiHook) claimVolumesFromAlloc() (map[string]*volumeAndRequest, error) claimType = structs.CSIVolumeClaimRead } + source := pair.request.Source + if pair.request.PerAlloc { + source = source + structs.AllocSuffix(c.alloc.Name) + } + req := &structs.CSIVolumeClaimRequest{ - VolumeID: pair.request.Source, + VolumeID: source, AllocationID: c.alloc.ID, NodeID: c.alloc.NodeID, Claim: claimType,