@@ -35,6 +35,7 @@ import (
35
35
e2evolume "k8s.io/kubernetes/test/e2e/framework/volume"
36
36
"k8s.io/kubernetes/test/e2e/storage/testpatterns"
37
37
"k8s.io/kubernetes/test/e2e/storage/utils"
38
+ imageutils "k8s.io/kubernetes/test/utils/image"
38
39
)
39
40
40
41
type multiVolumeTestSuite struct {
@@ -423,14 +424,14 @@ func testAccessMultipleVolumes(f *framework.Framework, cs clientset.Interface, n
423
424
424
425
if readSeedBase > 0 {
425
426
ginkgo .By (fmt .Sprintf ("Checking if read from the volume%d works properly" , index ))
426
- utils .CheckReadFromPath (f , pod , * pvc .Spec .VolumeMode , path , byteLen , readSeedBase + int64 (i ))
427
+ utils .CheckReadFromPath (f , pod , * pvc .Spec .VolumeMode , false , path , byteLen , readSeedBase + int64 (i ))
427
428
}
428
429
429
430
ginkgo .By (fmt .Sprintf ("Checking if write to the volume%d works properly" , index ))
430
- utils .CheckWriteToPath (f , pod , * pvc .Spec .VolumeMode , path , byteLen , writeSeedBase + int64 (i ))
431
+ utils .CheckWriteToPath (f , pod , * pvc .Spec .VolumeMode , false , path , byteLen , writeSeedBase + int64 (i ))
431
432
432
433
ginkgo .By (fmt .Sprintf ("Checking if read from the volume%d works properly" , index ))
433
- utils .CheckReadFromPath (f , pod , * pvc .Spec .VolumeMode , path , byteLen , writeSeedBase + int64 (i ))
434
+ utils .CheckReadFromPath (f , pod , * pvc .Spec .VolumeMode , false , path , byteLen , writeSeedBase + int64 (i ))
434
435
}
435
436
436
437
pod , err = cs .CoreV1 ().Pods (pod .Namespace ).Get (context .TODO (), pod .Name , metav1.GetOptions {})
@@ -481,6 +482,7 @@ func TestConcurrentAccessToSingleVolume(f *framework.Framework, cs clientset.Int
481
482
ginkgo .By (fmt .Sprintf ("Creating pod%d with a volume on %+v" , index , node ))
482
483
podConfig := e2epod.Config {
483
484
NS : ns ,
485
+ ImageID : imageutils .DebianIptables ,
484
486
PVCs : []* v1.PersistentVolumeClaim {pvc },
485
487
SeLinuxLabel : e2epv .SELinuxLabel ,
486
488
NodeSelection : node ,
@@ -506,6 +508,14 @@ func TestConcurrentAccessToSingleVolume(f *framework.Framework, cs clientset.Int
506
508
507
509
var seed int64
508
510
byteLen := 64
511
+ directIO := false
512
+ // direct IO is needed for Block-mode PVs
513
+ if * pvc .Spec .VolumeMode == v1 .PersistentVolumeBlock {
514
+ // byteLen should be the size of a sector to enable direct I/O
515
+ byteLen = 512
516
+ directIO = true
517
+ }
518
+
509
519
path := "/mnt/volume1"
510
520
// Check if volume can be accessed from each pod
511
521
for i , pod := range pods {
@@ -521,17 +531,17 @@ func TestConcurrentAccessToSingleVolume(f *framework.Framework, cs clientset.Int
521
531
if i != 0 {
522
532
ginkgo .By (fmt .Sprintf ("From pod%d, checking if reading the data that pod%d write works properly" , index , index - 1 ))
523
533
// For 1st pod, no one has written data yet, so pass the read check
524
- utils .CheckReadFromPath (f , pod , * pvc .Spec .VolumeMode , path , byteLen , seed )
534
+ utils .CheckReadFromPath (f , pod , * pvc .Spec .VolumeMode , directIO , path , byteLen , seed )
525
535
}
526
536
527
537
// Update the seed and check if write/read works properly
528
538
seed = time .Now ().UTC ().UnixNano ()
529
539
530
540
ginkgo .By (fmt .Sprintf ("Checking if write to the volume in pod%d works properly" , index ))
531
- utils .CheckWriteToPath (f , pod , * pvc .Spec .VolumeMode , path , byteLen , seed )
541
+ utils .CheckWriteToPath (f , pod , * pvc .Spec .VolumeMode , directIO , path , byteLen , seed )
532
542
533
543
ginkgo .By (fmt .Sprintf ("Checking if read from the volume in pod%d works properly" , index ))
534
- utils .CheckReadFromPath (f , pod , * pvc .Spec .VolumeMode , path , byteLen , seed )
544
+ utils .CheckReadFromPath (f , pod , * pvc .Spec .VolumeMode , directIO , path , byteLen , seed )
535
545
}
536
546
537
547
// Delete the last pod and remove from slice of pods
@@ -560,16 +570,16 @@ func TestConcurrentAccessToSingleVolume(f *framework.Framework, cs clientset.Int
560
570
} else {
561
571
ginkgo .By (fmt .Sprintf ("From pod%d, rechecking if reading the data that pod%d write works properly" , index , index - 1 ))
562
572
}
563
- utils .CheckReadFromPath (f , pod , * pvc .Spec .VolumeMode , path , byteLen , seed )
573
+ utils .CheckReadFromPath (f , pod , * pvc .Spec .VolumeMode , directIO , path , byteLen , seed )
564
574
565
575
// Update the seed and check if write/read works properly
566
576
seed = time .Now ().UTC ().UnixNano ()
567
577
568
578
ginkgo .By (fmt .Sprintf ("Rechecking if write to the volume in pod%d works properly" , index ))
569
- utils .CheckWriteToPath (f , pod , * pvc .Spec .VolumeMode , path , byteLen , seed )
579
+ utils .CheckWriteToPath (f , pod , * pvc .Spec .VolumeMode , directIO , path , byteLen , seed )
570
580
571
581
ginkgo .By (fmt .Sprintf ("Rechecking if read from the volume in pod%d works properly" , index ))
572
- utils .CheckReadFromPath (f , pod , * pvc .Spec .VolumeMode , path , byteLen , seed )
582
+ utils .CheckReadFromPath (f , pod , * pvc .Spec .VolumeMode , directIO , path , byteLen , seed )
573
583
}
574
584
}
575
585
0 commit comments