@@ -108,7 +108,7 @@ func getVolumeParameters(logger *zap.Logger, req *csi.CreateVolumeRequest, confi
108108 switch key {
109109 case Profile :
110110 if utils .ListContainsSubstr (SupportedProfile , value ) {
111- volume .VPCVolume . Profile = & provider.Profile {Name : value }
111+ volume .Profile = & provider.Profile {Name : value }
112112 } else {
113113 err = fmt .Errorf ("%s:<%v> unsupported profile. Supported profiles are: %v" , key , value , SupportedProfile )
114114 }
@@ -127,14 +127,14 @@ func getVolumeParameters(logger *zap.Logger, req *csi.CreateVolumeRequest, confi
127127 case Tag :
128128 if len (value ) != 0 {
129129 tagstr := strings .TrimSpace (value )
130- volume .VPCVolume . Tags = strings .Split (tagstr , "," )
130+ volume .Tags = strings .Split (tagstr , "," )
131131 }
132132
133133 case ResourceGroup :
134134 if len (value ) > ResourceGroupIDMaxLen {
135135 err = fmt .Errorf ("%s:<%v> exceeds %d chars" , key , value , ResourceGroupIDMaxLen )
136136 }
137- volume .VPCVolume . ResourceGroup = & provider.ResourceGroup {ID : value }
137+ volume .ResourceGroup = & provider.ResourceGroup {ID : value }
138138
139139 case BillingType :
140140 // Its not supported by RIaaS, but this is just information for the user
@@ -150,7 +150,7 @@ func getVolumeParameters(logger *zap.Logger, req *csi.CreateVolumeRequest, confi
150150 err = fmt .Errorf ("%s: exceeds %d bytes" , key , EncryptionKeyMaxLen )
151151 } else {
152152 if len (value ) != 0 {
153- volume .VPCVolume . VolumeEncryptionKey = & provider.VolumeEncryptionKey {CRN : value }
153+ volume .VolumeEncryptionKey = & provider.VolumeEncryptionKey {CRN : value }
154154 }
155155 }
156156
@@ -179,18 +179,18 @@ func getVolumeParameters(logger *zap.Logger, req *csi.CreateVolumeRequest, confi
179179 }
180180 // If encripted is set to false
181181 if encrypt == FalseStr {
182- volume .VPCVolume . VolumeEncryptionKey = nil
182+ volume .VolumeEncryptionKey = nil
183183 }
184184
185- if volume .VPCVolume . Profile == nil {
185+ if volume .Profile == nil {
186186 err = fmt .Errorf ("volume profile is empty, you need to pass valid profile name" )
187187 logger .Error ("getVolumeParameters" , zap .NamedError ("InvalidRequest" , err ))
188188 return volume , err
189189 }
190190
191191 // Get the requested capacity from the request
192192 capacityRange := req .GetCapacityRange ()
193- capBytes , err := getRequestedCapacity (capacityRange , volume .VPCVolume . Profile .Name )
193+ capBytes , err := getRequestedCapacity (capacityRange , volume .Profile .Name )
194194 if err != nil {
195195 err = fmt .Errorf ("invalid PVC capacity size: '%v'" , err )
196196 logger .Error ("getVolumeParameters" , zap .NamedError ("invalid parameter" , err ))
@@ -239,7 +239,7 @@ func getVolumeParameters(logger *zap.Logger, req *csi.CreateVolumeRequest, confi
239239 return volume , err
240240 }
241241
242- if volume .VPCVolume . Profile != nil && (volume .VPCVolume . Profile .Name != CustomProfile && volume . VPCVolume .Profile .Name != SDPProfile ) {
242+ if volume .Profile != nil && (volume .Profile .Name != CustomProfile && volume .Profile .Name != SDPProfile ) {
243243 // Specify IOPS only for custom or SDP class
244244 volume .Iops = nil
245245 }
@@ -273,7 +273,7 @@ func overrideParams(logger *zap.Logger, req *csi.CreateVolumeRequest, config *co
273273 err = fmt .Errorf ("%s:<%v> exceeds %d bytes " , key , value , ResourceGroupIDMaxLen )
274274 } else {
275275 logger .Info ("override" , zap .Any (ResourceGroup , value ))
276- volume .VPCVolume . ResourceGroup = & provider.ResourceGroup {ID : value }
276+ volume .ResourceGroup = & provider.ResourceGroup {ID : value }
277277 }
278278 case Encrypted :
279279 if value != TrueStr && value != FalseStr {
@@ -288,15 +288,15 @@ func overrideParams(logger *zap.Logger, req *csi.CreateVolumeRequest, config *co
288288 } else {
289289 if len (value ) != 0 {
290290 logger .Info ("override" , zap .String ("parameter" , EncryptionKey ))
291- volume .VPCVolume . VolumeEncryptionKey = & provider.VolumeEncryptionKey {CRN : value }
291+ volume .VolumeEncryptionKey = & provider.VolumeEncryptionKey {CRN : value }
292292 }
293293 }
294294 case Tag :
295295 if len (value ) != 0 {
296296 logger .Info ("append" , zap .Any (Tag , value ))
297297 tagstr := strings .TrimSpace (value )
298298 secretTags := strings .Split (tagstr , "," )
299- volume .VPCVolume . Tags = append (volume . VPCVolume .Tags , secretTags ... )
299+ volume .Tags = append (volume .Tags , secretTags ... )
300300 }
301301
302302 case Zone :
@@ -327,11 +327,11 @@ func overrideParams(logger *zap.Logger, req *csi.CreateVolumeRequest, config *co
327327 }
328328 }
329329 // Assign ResourceGroupID from config
330- if volume .VPCVolume . ResourceGroup == nil || len (volume . VPCVolume .ResourceGroup .ID ) < 1 {
331- volume .VPCVolume . ResourceGroup = & provider.ResourceGroup {ID : config .VPC .G2ResourceGroupID }
330+ if volume .ResourceGroup == nil || len (volume .ResourceGroup .ID ) < 1 {
331+ volume .ResourceGroup = & provider.ResourceGroup {ID : config .VPC .G2ResourceGroupID }
332332 }
333333 if encrypt == FalseStr {
334- volume .VPCVolume . VolumeEncryptionKey = nil
334+ volume .VolumeEncryptionKey = nil
335335 }
336336 return nil
337337}
0 commit comments