@@ -349,7 +349,7 @@ func deleteVolumeSnapshot(ctx context.Context, snapc *snapclient.Clientset, name
349
349
}
350
350
snapshotContentCreated := false
351
351
352
- if performCnsQueryVolumeSnapshot {
352
+ if performCnsQueryVolumeSnapshot && ! latebinding {
353
353
framework .Logf ("Verify snapshot entry %v is deleted from CNS for volume %v" , snapshotID , volHandle )
354
354
err = waitForCNSSnapshotToBeDeleted (volHandle , snapshotID )
355
355
if err != nil {
@@ -489,7 +489,7 @@ func createDynamicVolumeSnapshot(ctx context.Context, namespace string,
489
489
return volumeSnapshot , snapshotContent , false , false , snapshotId , "" , err
490
490
}
491
491
492
- if performCnsQueryVolumeSnapshot {
492
+ if performCnsQueryVolumeSnapshot && ! latebinding {
493
493
ginkgo .By ("Query CNS and check the volume snapshot entry" )
494
494
err = waitForCNSSnapshotToBeCreated (volHandle , snapshotId )
495
495
if err != nil {
@@ -684,21 +684,26 @@ func verifyVolumeRestoreOperation(ctx context.Context, client clientset.Interfac
684
684
volumeSnapshot * snapV1.VolumeSnapshot , diskSize string ,
685
685
verifyPodCreation bool ) (* v1.PersistentVolumeClaim , []* v1.PersistentVolume , * v1.Pod ) {
686
686
687
+ var volHandle2 string
688
+ var persistentvolumes2 []* v1.PersistentVolume
687
689
ginkgo .By ("Create PVC from snapshot" )
688
690
pvcSpec := getPersistentVolumeClaimSpecWithDatasource (namespace , diskSize , storageclass , nil ,
689
691
v1 .ReadWriteOnce , volumeSnapshot .Name , snapshotapigroup )
690
692
691
693
pvclaim2 , err := fpv .CreatePVC (ctx , client , namespace , pvcSpec )
692
694
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
693
695
694
- persistentvolumes2 , err := fpv .WaitForPVClaimBoundPhase (ctx , client ,
695
- []* v1.PersistentVolumeClaim {pvclaim2 }, framework .ClaimProvisionTimeout )
696
- gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
697
- volHandle2 := persistentvolumes2 [0 ].Spec .CSI .VolumeHandle
698
- if guestCluster {
699
- volHandle2 = getVolumeIDFromSupervisorCluster (volHandle2 )
696
+ if ! latebinding {
697
+ ginkgo .By ("Verify PVC bound state created with Immediate binding mode storage policy" )
698
+ persistentvolumes2 , err = fpv .WaitForPVClaimBoundPhase (ctx , client ,
699
+ []* v1.PersistentVolumeClaim {pvclaim2 }, framework .ClaimProvisionTimeout )
700
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
701
+ volHandle2 = persistentvolumes2 [0 ].Spec .CSI .VolumeHandle
702
+ if guestCluster {
703
+ volHandle2 = getVolumeIDFromSupervisorCluster (volHandle2 )
704
+ }
705
+ gomega .Expect (volHandle2 ).NotTo (gomega .BeEmpty ())
700
706
}
701
- gomega .Expect (volHandle2 ).NotTo (gomega .BeEmpty ())
702
707
703
708
var pod * v1.Pod
704
709
if verifyPodCreation {
@@ -770,35 +775,38 @@ func createPVCAndQueryVolumeInCNS(ctx context.Context, client clientset.Interfac
770
775
return pvclaim , nil , fmt .Errorf ("failed to create PVC: %w" , err )
771
776
}
772
777
773
- // Wait for PVC to be bound to a PV
774
- persistentvolumes , err := fpv .WaitForPVClaimBoundPhase (ctx , client ,
775
- []* v1.PersistentVolumeClaim {pvclaim }, framework .ClaimProvisionTimeout * 2 )
776
- if err != nil {
777
- return pvclaim , persistentvolumes , fmt .Errorf ("failed to wait for PVC to bind to a PV: %w" , err )
778
- }
779
-
780
- // Get VolumeHandle from the PV
781
- volHandle := persistentvolumes [0 ].Spec .CSI .VolumeHandle
782
- if guestCluster {
783
- volHandle = getVolumeIDFromSupervisorCluster (volHandle )
784
- }
785
- if volHandle == "" {
786
- return pvclaim , persistentvolumes , fmt .Errorf ("volume handle is empty" )
787
- }
788
-
789
- // Verify the volume in CNS if required
790
- if verifyCNSVolume {
791
- ginkgo .By (fmt .Sprintf ("Invoking QueryCNSVolumeWithResult with VolumeID: %s" , volHandle ))
792
- queryResult , err := e2eVSphere .queryCNSVolumeWithResult (volHandle )
778
+ if ! latebinding {
779
+ ginkgo .By ("Verify PVC bound state created with Immediate binding mode storage policy" )
780
+ persistentvolumes , err := fpv .WaitForPVClaimBoundPhase (ctx , client ,
781
+ []* v1.PersistentVolumeClaim {pvclaim }, framework .ClaimProvisionTimeout * 2 )
793
782
if err != nil {
794
- return pvclaim , persistentvolumes , fmt .Errorf ("failed to query CNS volume: %w" , err )
783
+ return pvclaim , persistentvolumes , fmt .Errorf ("failed to wait for PVC to bind to a PV: %w" , err )
784
+ }
785
+
786
+ // Get VolumeHandle from the PV
787
+ volHandle := persistentvolumes [0 ].Spec .CSI .VolumeHandle
788
+ if guestCluster {
789
+ volHandle = getVolumeIDFromSupervisorCluster (volHandle )
790
+ }
791
+ if volHandle == "" {
792
+ return pvclaim , persistentvolumes , fmt .Errorf ("volume handle is empty" )
795
793
}
796
- if len (queryResult .Volumes ) == 0 || queryResult .Volumes [0 ].VolumeId .Id != volHandle {
797
- return pvclaim , persistentvolumes , fmt .Errorf ("CNS query returned unexpected result" )
794
+
795
+ // Verify the volume in CNS if required
796
+ if verifyCNSVolume {
797
+ ginkgo .By (fmt .Sprintf ("Invoking QueryCNSVolumeWithResult with VolumeID: %s" , volHandle ))
798
+ queryResult , err := e2eVSphere .queryCNSVolumeWithResult (volHandle )
799
+ if err != nil {
800
+ return pvclaim , persistentvolumes , fmt .Errorf ("failed to query CNS volume: %w" , err )
801
+ }
802
+ if len (queryResult .Volumes ) == 0 || queryResult .Volumes [0 ].VolumeId .Id != volHandle {
803
+ return pvclaim , persistentvolumes , fmt .Errorf ("CNS query returned unexpected result" )
804
+ }
798
805
}
806
+ return pvclaim , persistentvolumes , nil
799
807
}
800
808
801
- return pvclaim , persistentvolumes , nil
809
+ return pvclaim , nil , nil
802
810
}
803
811
804
812
// waitForVolumeSnapshotContentReadyToUse waits for the volume's snapshot content to be in ReadyToUse
0 commit comments