@@ -27,7 +27,7 @@ import (
2727 "github.com/go-viper/mapstructure/v2"
2828 "github.com/kubernetes-csi/csi-lib-utils/protosanitizer"
2929 "github.com/stackitcloud/cloud-provider-stackit/pkg/csi/util"
30- "github.com/stackitcloud/stackit-sdk-go/services/iaas"
30+ iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api "
3131 "google.golang.org/grpc/codes"
3232 "google.golang.org/grpc/status"
3333 "google.golang.org/protobuf/types/known/timestamppb"
@@ -130,7 +130,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
130130 if * vols [0 ].Status != stackit .VolumeAvailableStatus {
131131 return nil , status .Error (codes .Internal , fmt .Sprintf ("Volume %s is not in available state" , * vols [0 ].Id ))
132132 }
133- 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 )
133+ 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 )
134134 return getCreateVolumeResponse (& vols [0 ]), nil
135135 } else if len (vols ) > 1 {
136136 klog .V (3 ).Infof ("found multiple existing volumes with selected name (%s) during create" , volName )
@@ -175,8 +175,8 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
175175 if err != nil {
176176 return nil , status .Errorf (codes .Internal , "Failed to retrieve the source volume of snapshot %s: %v" , sourceSnapshotID , err )
177177 }
178- if * snapshotVolSrc .AvailabilityZone != volAvailability {
179- return nil , status .Errorf (codes .ResourceExhausted , "Volume must be in the same availability zone as source Snapshot. Got %s Required: %s" , volAvailability , * snapshotVolSrc .AvailabilityZone )
178+ if snapshotVolSrc .AvailabilityZone != volAvailability {
179+ return nil , status .Errorf (codes .ResourceExhausted , "Volume must be in the same availability zone as source Snapshot. Got %s Required: %s" , volAvailability , snapshotVolSrc .AvailabilityZone )
180180 }
181181 }
182182
@@ -208,8 +208,8 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
208208 }
209209 return nil , status .Errorf (codes .Internal , "Failed to retrieve the source volume %s: %v" , sourceVolID , err )
210210 }
211- if volAvailability != * sourceVolume .AvailabilityZone {
212- return nil , status .Errorf (codes .ResourceExhausted , "Volume must be in the same availability zone as source Volume. Got %s Required: %s" , volAvailability , * sourceVolume .AvailabilityZone )
211+ if volAvailability != sourceVolume .AvailabilityZone {
212+ return nil , status .Errorf (codes .ResourceExhausted , "Volume must be in the same availability zone as source Volume. Got %s Required: %s" , volAvailability , sourceVolume .AvailabilityZone )
213213 }
214214 volumeSourceType = stackit .VolumeSource
215215 }
@@ -218,7 +218,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
218218 Name : new (volName ),
219219 PerformanceClass : volParams .PerformanceClass ,
220220 Size : new (volSizeGB ),
221- AvailabilityZone : new ( volAvailability ) ,
221+ AvailabilityZone : volAvailability ,
222222 //TODO: IaaS API does not allow dots or slashes. Additionally we would like to actually use metadata/annotations
223223 //Labels: new(util.ConvertMapStringToInterface(properties)),
224224 }
@@ -233,8 +233,8 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
233233 volumeSourceID := determineSourceIDForSourceType (volumeSourceType , sourceSnapshotID , sourceVolID )
234234 klog .V (4 ).Infof ("Creating volume from %s source" , volumeSourceType )
235235 opts .Source = & iaas.VolumeSource {
236- Id : new ( volumeSourceID ) ,
237- Type : new ( string (volumeSourceType ) ),
236+ Id : volumeSourceID ,
237+ Type : string (volumeSourceType ),
238238 }
239239 }
240240
@@ -272,7 +272,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
272272 return nil , status .Error (codes .Internal , fmt .Sprintf ("CreateVolume Volume %s failed getting available in time: %v" , * vol .Id , err ))
273273 }
274274
275- klog .V (4 ).Infof ("CreateVolume: Successfully created volume %s in Availability Zone: %s of size %d GiB" , * vol .Id , * vol .AvailabilityZone , * vol .Size )
275+ klog .V (4 ).Infof ("CreateVolume: Successfully created volume %s in Availability Zone: %s of size %d GiB" , * vol .Id , vol .AvailabilityZone , * vol .Size )
276276
277277 return getCreateVolumeResponse (vol ), nil
278278}
@@ -289,10 +289,10 @@ func setVolumeEncryptionParameters(opts *iaas.CreateVolumePayload, volParams *st
289289 }
290290
291291 encryptionConfig := & iaas.VolumeEncryptionParameter {
292- KekKeyId : volParams .KMSKeyID ,
293- KekKeyVersion : new ( int64 (kmsKeyVersionInt ) ),
294- KekKeyringId : volParams .KMSKeyringID ,
295- ServiceAccount : volParams .KMSServiceAccount ,
292+ KekKeyId : * volParams .KMSKeyID ,
293+ KekKeyVersion : int64 (kmsKeyVersionInt ),
294+ KekKeyringId : * volParams .KMSKeyringID ,
295+ ServiceAccount : * volParams .KMSServiceAccount ,
296296 }
297297
298298 if volParams .KMSProjectID != nil {
@@ -571,7 +571,7 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
571571 Snapshot : & csi.Snapshot {
572572 SnapshotId : * snap .Id ,
573573 SizeBytes : * snap .Size * util .GIBIBYTE ,
574- SourceVolumeId : * snap .VolumeId ,
574+ SourceVolumeId : snap .VolumeId ,
575575 CreationTime : ctime ,
576576 ReadyToUse : true ,
577577 },
@@ -643,7 +643,7 @@ func (cs *controllerServer) createSnapshot(ctx context.Context, cloud stackit.Ia
643643 // Verify a snapshot with the provided name doesn't already exist for this tenant
644644 if len (snapshots ) == 1 {
645645 snap := & snapshots [0 ]
646- if * snap .VolumeId != volumeID {
646+ if snap .VolumeId != volumeID {
647647 return nil , status .Error (codes .AlreadyExists , "Snapshot with given name already exists, with different source volume ID" )
648648 }
649649
@@ -754,7 +754,7 @@ func (cs *controllerServer) ListSnapshots(ctx context.Context, req *csi.ListSnap
754754 Snapshot : & csi.Snapshot {
755755 SizeBytes : * snap .Size * util .GIBIBYTE ,
756756 SnapshotId : * snap .Id ,
757- SourceVolumeId : * snap .VolumeId ,
757+ SourceVolumeId : snap .VolumeId ,
758758 CreationTime : ctime ,
759759 ReadyToUse : true ,
760760 },
@@ -798,7 +798,7 @@ func (cs *controllerServer) ListSnapshots(ctx context.Context, req *csi.ListSnap
798798 Snapshot : & csi.Snapshot {
799799 SizeBytes : * v .Size * util .GIBIBYTE ,
800800 SnapshotId : * v .Id ,
801- SourceVolumeId : * v .VolumeId ,
801+ SourceVolumeId : v .VolumeId ,
802802 CreationTime : ctime ,
803803 ReadyToUse : true ,
804804 },
@@ -967,15 +967,15 @@ func getCreateVolumeResponse(vol *iaas.Volume) *csi.CreateVolumeResponse {
967967 volCnx := map [string ]string {}
968968
969969 if vol .Source != nil {
970- volumeSourceType = stackit .VolumeSourceTypes (* vol .Source .Type )
970+ volumeSourceType = stackit .VolumeSourceTypes (vol .Source .Type )
971971 switch volumeSourceType {
972972 case stackit .VolumeSource :
973973 volCnx [ResizeRequired ] = "true"
974974
975975 volsrc = & csi.VolumeContentSource {
976976 Type : & csi.VolumeContentSource_Volume {
977977 Volume : & csi.VolumeContentSource_VolumeSource {
978- VolumeId : * vol .Source .Id ,
978+ VolumeId : vol .Source .Id ,
979979 },
980980 },
981981 }
@@ -985,7 +985,7 @@ func getCreateVolumeResponse(vol *iaas.Volume) *csi.CreateVolumeResponse {
985985 volsrc = & csi.VolumeContentSource {
986986 Type : & csi.VolumeContentSource_Snapshot {
987987 Snapshot : & csi.VolumeContentSource_SnapshotSource {
988- SnapshotId : * vol .Source .Id ,
988+ SnapshotId : vol .Source .Id ,
989989 },
990990 },
991991 }
@@ -995,7 +995,7 @@ func getCreateVolumeResponse(vol *iaas.Volume) *csi.CreateVolumeResponse {
995995 volsrc = & csi.VolumeContentSource {
996996 Type : & csi.VolumeContentSource_Snapshot {
997997 Snapshot : & csi.VolumeContentSource_SnapshotSource {
998- SnapshotId : * vol .Source .Id ,
998+ SnapshotId : vol .Source .Id ,
999999 },
10001000 },
10011001 }
@@ -1004,7 +1004,7 @@ func getCreateVolumeResponse(vol *iaas.Volume) *csi.CreateVolumeResponse {
10041004
10051005 accessibleTopology := []* csi.Topology {
10061006 {
1007- Segments : map [string ]string {topologyKey : ptr . Deref ( vol .AvailabilityZone , "" ) },
1007+ Segments : map [string ]string {topologyKey : vol .AvailabilityZone },
10081008 },
10091009 }
10101010
0 commit comments