@@ -108,7 +108,7 @@ func getVolumeParameters(logger *zap.Logger, req *csi.CreateVolumeRequest, confi
108
108
switch key {
109
109
case Profile :
110
110
if utils .ListContainsSubstr (SupportedProfile , value ) {
111
- volume .VPCVolume . Profile = & provider.Profile {Name : value }
111
+ volume .Profile = & provider.Profile {Name : value }
112
112
} else {
113
113
err = fmt .Errorf ("%s:<%v> unsupported profile. Supported profiles are: %v" , key , value , SupportedProfile )
114
114
}
@@ -127,14 +127,14 @@ func getVolumeParameters(logger *zap.Logger, req *csi.CreateVolumeRequest, confi
127
127
case Tag :
128
128
if len (value ) != 0 {
129
129
tagstr := strings .TrimSpace (value )
130
- volume .VPCVolume . Tags = strings .Split (tagstr , "," )
130
+ volume .Tags = strings .Split (tagstr , "," )
131
131
}
132
132
133
133
case ResourceGroup :
134
134
if len (value ) > ResourceGroupIDMaxLen {
135
135
err = fmt .Errorf ("%s:<%v> exceeds %d chars" , key , value , ResourceGroupIDMaxLen )
136
136
}
137
- volume .VPCVolume . ResourceGroup = & provider.ResourceGroup {ID : value }
137
+ volume .ResourceGroup = & provider.ResourceGroup {ID : value }
138
138
139
139
case BillingType :
140
140
// 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
150
150
err = fmt .Errorf ("%s: exceeds %d bytes" , key , EncryptionKeyMaxLen )
151
151
} else {
152
152
if len (value ) != 0 {
153
- volume .VPCVolume . VolumeEncryptionKey = & provider.VolumeEncryptionKey {CRN : value }
153
+ volume .VolumeEncryptionKey = & provider.VolumeEncryptionKey {CRN : value }
154
154
}
155
155
}
156
156
@@ -179,18 +179,18 @@ func getVolumeParameters(logger *zap.Logger, req *csi.CreateVolumeRequest, confi
179
179
}
180
180
// If encripted is set to false
181
181
if encrypt == FalseStr {
182
- volume .VPCVolume . VolumeEncryptionKey = nil
182
+ volume .VolumeEncryptionKey = nil
183
183
}
184
184
185
- if volume .VPCVolume . Profile == nil {
185
+ if volume .Profile == nil {
186
186
err = fmt .Errorf ("volume profile is empty, you need to pass valid profile name" )
187
187
logger .Error ("getVolumeParameters" , zap .NamedError ("InvalidRequest" , err ))
188
188
return volume , err
189
189
}
190
190
191
191
// Get the requested capacity from the request
192
192
capacityRange := req .GetCapacityRange ()
193
- capBytes , err := getRequestedCapacity (capacityRange , volume .VPCVolume . Profile .Name )
193
+ capBytes , err := getRequestedCapacity (capacityRange , volume .Profile .Name )
194
194
if err != nil {
195
195
err = fmt .Errorf ("invalid PVC capacity size: '%v'" , err )
196
196
logger .Error ("getVolumeParameters" , zap .NamedError ("invalid parameter" , err ))
@@ -239,7 +239,7 @@ func getVolumeParameters(logger *zap.Logger, req *csi.CreateVolumeRequest, confi
239
239
return volume , err
240
240
}
241
241
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 ) {
243
243
// Specify IOPS only for custom or SDP class
244
244
volume .Iops = nil
245
245
}
@@ -273,7 +273,7 @@ func overrideParams(logger *zap.Logger, req *csi.CreateVolumeRequest, config *co
273
273
err = fmt .Errorf ("%s:<%v> exceeds %d bytes " , key , value , ResourceGroupIDMaxLen )
274
274
} else {
275
275
logger .Info ("override" , zap .Any (ResourceGroup , value ))
276
- volume .VPCVolume . ResourceGroup = & provider.ResourceGroup {ID : value }
276
+ volume .ResourceGroup = & provider.ResourceGroup {ID : value }
277
277
}
278
278
case Encrypted :
279
279
if value != TrueStr && value != FalseStr {
@@ -288,15 +288,15 @@ func overrideParams(logger *zap.Logger, req *csi.CreateVolumeRequest, config *co
288
288
} else {
289
289
if len (value ) != 0 {
290
290
logger .Info ("override" , zap .String ("parameter" , EncryptionKey ))
291
- volume .VPCVolume . VolumeEncryptionKey = & provider.VolumeEncryptionKey {CRN : value }
291
+ volume .VolumeEncryptionKey = & provider.VolumeEncryptionKey {CRN : value }
292
292
}
293
293
}
294
294
case Tag :
295
295
if len (value ) != 0 {
296
296
logger .Info ("append" , zap .Any (Tag , value ))
297
297
tagstr := strings .TrimSpace (value )
298
298
secretTags := strings .Split (tagstr , "," )
299
- volume .VPCVolume . Tags = append (volume . VPCVolume .Tags , secretTags ... )
299
+ volume .Tags = append (volume .Tags , secretTags ... )
300
300
}
301
301
302
302
case Zone :
@@ -327,11 +327,11 @@ func overrideParams(logger *zap.Logger, req *csi.CreateVolumeRequest, config *co
327
327
}
328
328
}
329
329
// 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 }
332
332
}
333
333
if encrypt == FalseStr {
334
- volume .VPCVolume . VolumeEncryptionKey = nil
334
+ volume .VolumeEncryptionKey = nil
335
335
}
336
336
return nil
337
337
}
0 commit comments