@@ -1130,25 +1130,29 @@ func deleteVMServiceVmInParallel(ctx context.Context, c ctlrclient.Client,
1130
1130
func performVolumeLifecycleActionForVmServiceVM (ctx context.Context , client clientset.Interface ,
1131
1131
vmopC ctlrclient.Client , cnsopC ctlrclient.Client , vmClass string , namespace string , vmi string ,
1132
1132
sc * storagev1.StorageClass , secretName string ) {
1133
+ var volHandle string
1133
1134
ginkgo .By ("Create a PVC" )
1134
1135
pvc , err := createPVC (ctx , client , namespace , nil , "" , sc , "" )
1135
1136
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
1136
- ginkgo .By ("Waiting for all claims to be in bound state" )
1137
- pvs , err := fpv .WaitForPVClaimBoundPhase (ctx , client , []* v1.PersistentVolumeClaim {pvc }, pollTimeout )
1138
- gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
1139
- pv := pvs [0 ]
1140
- volHandle := pv .Spec .CSI .VolumeHandle
1141
- gomega .Expect (volHandle ).NotTo (gomega .BeEmpty ())
1142
- defer func () {
1143
- ginkgo .By ("Delete PVCs" )
1144
- err = fpv .DeletePersistentVolumeClaim (ctx , client , pvc .Name , namespace )
1137
+ if ! latebinding {
1138
+ ginkgo .By ("Waiting for all claims to be in bound state" )
1139
+ pvs , err := fpv .WaitForPVClaimBoundPhase (ctx , client , []* v1.PersistentVolumeClaim {pvc }, pollTimeout )
1145
1140
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
1141
+ pv := pvs [0 ]
1142
+ volHandle = pv .Spec .CSI .VolumeHandle
1143
+ gomega .Expect (volHandle ).NotTo (gomega .BeEmpty ())
1144
+ defer func () {
1145
+ ginkgo .By ("Delete PVCs" )
1146
+ err = fpv .DeletePersistentVolumeClaim (ctx , client , pvc .Name , namespace )
1147
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
1146
1148
1147
- ginkgo .By ("Waiting for CNS volumes to be deleted" )
1148
- err = e2eVSphere .waitForCNSVolumeToBeDeleted (volHandle )
1149
- gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
1149
+ ginkgo .By ("Waiting for CNS volumes to be deleted" )
1150
+ err = e2eVSphere .waitForCNSVolumeToBeDeleted (volHandle )
1151
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
1150
1152
1151
- }()
1153
+ }()
1154
+
1155
+ }
1152
1156
1153
1157
ginkgo .By ("Creating VM" )
1154
1158
vm := createVmServiceVmWithPvcs (
@@ -1173,6 +1177,15 @@ func performVolumeLifecycleActionForVmServiceVM(ctx context.Context, client clie
1173
1177
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
1174
1178
}()
1175
1179
1180
+ if latebinding {
1181
+ ginkgo .By ("Waiting for all claims to be in bound state" )
1182
+ pvs , err := fpv .WaitForPVClaimBoundPhase (ctx , client , []* v1.PersistentVolumeClaim {pvc }, pollTimeout )
1183
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
1184
+ pv := pvs [0 ]
1185
+ volHandle = pv .Spec .CSI .VolumeHandle
1186
+ gomega .Expect (volHandle ).NotTo (gomega .BeEmpty ())
1187
+
1188
+ }
1176
1189
ginkgo .By ("Wait and verify PVCs are attached to the VM" )
1177
1190
gomega .Expect (waitNverifyPvcsAreAttachedToVmsvcVm (ctx , vmopC , cnsopC , vm ,
1178
1191
[]* v1.PersistentVolumeClaim {pvc })).NotTo (gomega .HaveOccurred ())
0 commit comments