@@ -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 {
@@ -957,7 +961,7 @@ func (cs *controllerServer) ControllerExpandVolume(ctx context.Context, req *csi
957961 }, nil
958962}
959963
960- func getCreateVolumeResponse (vol * iaas.Volume ) * csi.CreateVolumeResponse {
964+ func ( cs * controllerServer ) getCreateVolumeResponse (vol * iaas.Volume ) * csi.CreateVolumeResponse {
961965 var volsrc * csi.VolumeContentSource
962966 var volumeSourceType stackit.VolumeSourceTypes
963967 volCnx := map [string ]string {}
@@ -998,9 +1002,14 @@ func getCreateVolumeResponse(vol *iaas.Volume) *csi.CreateVolumeResponse {
9981002 }
9991003 }
10001004
1005+ topoKey := topologyKey
1006+ if cs .Driver .legacyDriver {
1007+ topoKey = legacyTopologyKey
1008+ }
1009+
10011010 accessibleTopology := []* csi.Topology {
10021011 {
1003- Segments : map [string ]string {topologyKey : ptr .Deref (vol .AvailabilityZone , "" )},
1012+ Segments : map [string ]string {topoKey : ptr .Deref (vol .AvailabilityZone , "" )},
10041013 },
10051014 }
10061015
0 commit comments