@@ -22,8 +22,12 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
2222 return nil , status .Error (codes .InvalidArgument , "volume capabilities missing in request" )
2323 }
2424
25- // Keep a record of the requested access types.
26- var accessTypeMount , accessTypeBlock bool
25+ var (
26+ // Keep a record of the requested access types.
27+ accessTypeMount , accessTypeBlock bool
28+
29+ integrity = false
30+ )
2731
2832 for _ , cap := range caps {
2933 if cap .GetBlock () != nil {
@@ -46,16 +50,19 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
4650 return nil , status .Errorf (codes .Internal , "lvmType is incorrect: %s" , lvmType )
4751 }
4852
49- integrity , err := strconv .ParseBool (req .GetParameters ()["integrity" ])
50- if err != nil {
51- d .log .Warn ("could not parse 'integrity' request parameter, assuming false" , "error" , err )
53+ if value , ok := req .GetParameters ()["integrity" ]; ok {
54+ var err error
55+ integrity , err = strconv .ParseBool (value )
56+ if err != nil {
57+ return nil , fmt .Errorf ("unable to parse integrity parameter to bool: %w" , err )
58+ }
5259 }
5360
5461 d .log .Info ("creating volume" , "name" , req .GetName ())
5562
5663 requiredBytes := req .GetCapacityRange ().GetRequiredBytes ()
5764
58- _ , err = lvm .CreateLV (d .log , d .vgName , req .GetName (), uint64 (requiredBytes ), lvmType , integrity )
65+ _ , err : = lvm .CreateLV (d .log , d .vgName , req .GetName (), uint64 (requiredBytes ), lvmType , integrity )
5966 if err != nil {
6067 return nil , fmt .Errorf ("unable to create lv %s: %w" , req .GetName (), err )
6168 }
0 commit comments