Skip to content

Commit 5705a33

Browse files
committed
cinder-csi-plugin: Use generated VolumeContext
Looks like an oversight in commit 7bfb2eb. Signed-off-by: Stephen Finucane <[email protected]>
1 parent eaf3993 commit 5705a33

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pkg/csi/cinder/controllerserver.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
205205

206206
// Set scheduler hints if affinity or anti-affinity is set in PVC annotations
207207
var schedulerHints volumes.SchedulerHintOptsBuilder
208-
var volCtx map[string]string
208+
volCtx := map[string]string{}
209209
affinity := pvcAnnotations[affinityKey]
210210
antiAffinity := pvcAnnotations[antiAffinityKey]
211211
if affinity != "" || antiAffinity != "" {
@@ -1037,10 +1037,9 @@ func (cs *controllerServer) ControllerExpandVolume(ctx context.Context, req *csi
10371037

10381038
func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, ignoreVolumeAZ bool, accessibleTopologyReq *csi.TopologyRequirement) *csi.CreateVolumeResponse {
10391039
var volsrc *csi.VolumeContentSource
1040-
volCnx := map[string]string{}
10411040

10421041
if vol.SnapshotID != "" {
1043-
volCnx[ResizeRequired] = "true"
1042+
volCtx[ResizeRequired] = "true"
10441043

10451044
volsrc = &csi.VolumeContentSource{
10461045
Type: &csi.VolumeContentSource_Snapshot{
@@ -1052,7 +1051,7 @@ func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, igno
10521051
}
10531052

10541053
if vol.SourceVolID != "" {
1055-
volCnx[ResizeRequired] = "true"
1054+
volCtx[ResizeRequired] = "true"
10561055

10571056
volsrc = &csi.VolumeContentSource{
10581057
Type: &csi.VolumeContentSource_Volume{
@@ -1064,7 +1063,7 @@ func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, igno
10641063
}
10651064

10661065
if vol.BackupID != nil && *vol.BackupID != "" {
1067-
volCnx[ResizeRequired] = "true"
1066+
volCtx[ResizeRequired] = "true"
10681067

10691068
volsrc = &csi.VolumeContentSource{
10701069
Type: &csi.VolumeContentSource_Snapshot{
@@ -1096,7 +1095,7 @@ func getCreateVolumeResponse(vol *volumes.Volume, volCtx map[string]string, igno
10961095
CapacityBytes: int64(vol.Size * 1024 * 1024 * 1024),
10971096
AccessibleTopology: accessibleTopology,
10981097
ContentSource: volsrc,
1099-
VolumeContext: volCnx,
1098+
VolumeContext: volCtx,
11001099
},
11011100
}
11021101

0 commit comments

Comments
 (0)