@@ -112,7 +112,11 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
112112 accessibleTopologyReq := req .GetAccessibilityRequirements ()
113113 // Check from topology
114114 if accessibleTopologyReq != nil {
115- volAvailability = sharedcsi .GetAZFromTopology (topologyKey , accessibleTopologyReq )
115+ if cs .Driver .legacyDriver {
116+ volAvailability = sharedcsi .GetAZFromTopology (legacyTopologyKey , accessibleTopologyReq )
117+ } else {
118+ volAvailability = sharedcsi .GetAZFromTopology (topologyKey , accessibleTopologyReq )
119+ }
116120 }
117121 }
118122
@@ -131,7 +135,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
131135 return nil , status .Error (codes .Internal , fmt .Sprintf ("Volume %s is not in available state" , * vols [0 ].Id ))
132136 }
133137 klog .V (4 ).Infof ("Volume %s already exists in Availability Zone: %s of size %d GiB" , * vols [0 ].Id , vols [0 ].AvailabilityZone , * vols [0 ].Size )
134- return getCreateVolumeResponse (& vols [0 ]), nil
138+ return cs . getCreateVolumeResponse (& vols [0 ]), nil
135139 } else if len (vols ) > 1 {
136140 klog .V (3 ).Infof ("found multiple existing volumes with selected name (%s) during create" , volName )
137141 return nil , status .Error (codes .Internal , "Multiple volumes reported by Cinder with same name" )
@@ -274,7 +278,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
274278
275279 klog .V (4 ).Infof ("CreateVolume: Successfully created volume %s in Availability Zone: %s of size %d GiB" , * vol .Id , vol .AvailabilityZone , * vol .Size )
276280
277- return getCreateVolumeResponse (vol ), nil
281+ return cs . getCreateVolumeResponse (vol ), nil
278282}
279283
280284func setVolumeEncryptionParameters (opts * iaas.CreateVolumePayload , volParams * stackitParameterConfig ) error {
@@ -961,7 +965,7 @@ func (cs *controllerServer) ControllerExpandVolume(ctx context.Context, req *csi
961965 }, nil
962966}
963967
964- func getCreateVolumeResponse (vol * iaas.Volume ) * csi.CreateVolumeResponse {
968+ func ( cs * controllerServer ) getCreateVolumeResponse (vol * iaas.Volume ) * csi.CreateVolumeResponse {
965969 var volsrc * csi.VolumeContentSource
966970 var volumeSourceType stackit.VolumeSourceTypes
967971 volCnx := map [string ]string {}
@@ -1002,9 +1006,14 @@ func getCreateVolumeResponse(vol *iaas.Volume) *csi.CreateVolumeResponse {
10021006 }
10031007 }
10041008
1009+ topoKey := topologyKey
1010+ if cs .Driver .legacyDriver {
1011+ topoKey = legacyTopologyKey
1012+ }
1013+
10051014 accessibleTopology := []* csi.Topology {
10061015 {
1007- Segments : map [string ]string {topologyKey : vol .AvailabilityZone },
1016+ Segments : map [string ]string {topoKey : vol .AvailabilityZone },
10081017 },
10091018 }
10101019
0 commit comments