@@ -78,6 +78,7 @@ type volumeAction struct {
7878 namespace string
7979 vgName string
8080 hostWritePath string
81+ integrity bool
8182}
8283
8384const (
@@ -264,6 +265,9 @@ func createProvisionerPod(ctx context.Context, va volumeAction) (err error) {
264265 args := []string {}
265266 if va .action == actionTypeCreate {
266267 args = append (args , "createlv" , "--lvsize" , fmt .Sprintf ("%d" , va .size ), "--devices" , va .devicesPattern , "--lvmtype" , va .lvmType )
268+ if va .integrity {
269+ args = append (args , "--integrity" )
270+ }
267271 }
268272 if va .action == actionTypeDelete {
269273 args = append (args , "deletelv" )
@@ -511,7 +515,7 @@ func CreateVG(name string, devicesPattern string) (string, error) {
511515
512516// CreateLVS creates the new volume
513517// used by lvcreate provisioner pod and by nodeserver for ephemeral volumes
514- func CreateLVS (vg string , name string , size uint64 , lvmType string ) (string , error ) {
518+ func CreateLVS (vg string , name string , size uint64 , lvmType string , integrity bool ) (string , error ) {
515519
516520 if lvExists (vg , name ) {
517521 klog .Infof ("logicalvolume: %s already exists\n " , name )
@@ -550,6 +554,15 @@ func CreateLVS(vg string, name string, size uint64, lvmType string) (string, err
550554 return "" , fmt .Errorf ("unsupported lvmtype: %s" , lvmType )
551555 }
552556
557+ if integrity {
558+ switch lvmType {
559+ case mirrorType :
560+ args = append (args , "--raidintegrity" , "y" )
561+ default :
562+ return "" , fmt .Errorf ("integrity is only supported if type is mirror" )
563+ }
564+ }
565+
553566 tags := []string {"lv.metal-stack.io/csi-lvm-driver" }
554567 for _ , tag := range tags {
555568 args = append (args , "--addtag" , tag )
0 commit comments