@@ -329,7 +329,7 @@ func (v *volumeModifyTestSuite) DefineTests(driver storageframework.TestDriver,
329
329
originPv := pv .DeepCopy ()
330
330
pv .Spec .PersistentVolumeReclaimPolicy = v1 .PersistentVolumeReclaimRetain
331
331
_ , err = f .ClientSet .CoreV1 ().PersistentVolumes ().Update (ctx , pv , metav1.UpdateOptions {})
332
- ginkgo .DeferCleanup (recoverPvReclaimPolicyAndRemoveClaimRef , f .ClientSet , originPv )
332
+ ginkgo .DeferCleanup (recoverPvReclaimPolicy , f .ClientSet , originPv )
333
333
framework .ExpectNoError (err , "Failed to update PV %q reclaim policy" , pvName )
334
334
335
335
// The vac_protection_controller make sure there is a VolumeAttributesClass that is not used by any PVC/PV
@@ -370,7 +370,7 @@ func (v *volumeModifyTestSuite) DefineTests(driver storageframework.TestDriver,
370
370
371
371
ginkgo .By (fmt .Sprintf ("Deleting PV %q to make the vac unused for the PV" , newVAC .Name ))
372
372
pv .Spec .PersistentVolumeReclaimPolicy = v1 .PersistentVolumeReclaimDelete
373
- recoverPvReclaimPolicyAndRemoveClaimRef (ctx , f .ClientSet , pv )
373
+ recoverPvReclaimPolicy (ctx , f .ClientSet , pv )
374
374
375
375
ginkgo .By (fmt .Sprintf ("Waiting for PV %q to be deleted" , pvName ))
376
376
gomega .Eventually (func () bool {
@@ -433,8 +433,8 @@ func CleanupVAC(ctx context.Context, vac *storagev1.VolumeAttributesClass, c cli
433
433
}, timeout , modifyPollInterval ).Should (gomega .BeNil ())
434
434
}
435
435
436
- // recoverPvReclaimPolicyAndRemoveClaimRef recovers the test pv's reclaim policy to expected used for clean up test PV
437
- func recoverPvReclaimPolicyAndRemoveClaimRef (ctx context.Context , c clientset.Interface , expectedPv * v1.PersistentVolume ) {
436
+ // recoverPvReclaimPolicy recovers the test pv's reclaim policy to expected used for clean up test PV
437
+ func recoverPvReclaimPolicy (ctx context.Context , c clientset.Interface , expectedPv * v1.PersistentVolume ) {
438
438
setPvReclaimPolicyErr := retry .RetryOnConflict (retry .DefaultRetry , func () error {
439
439
pv , err := c .CoreV1 ().PersistentVolumes ().Get (ctx , expectedPv .Name , metav1.GetOptions {})
440
440
if err != nil {
@@ -444,11 +444,10 @@ func recoverPvReclaimPolicyAndRemoveClaimRef(ctx context.Context, c clientset.In
444
444
}
445
445
return err
446
446
}
447
- if pv .Spec .PersistentVolumeReclaimPolicy == expectedPv .Spec .PersistentVolumeReclaimPolicy && pv . Spec . ClaimRef == nil {
447
+ if pv .Spec .PersistentVolumeReclaimPolicy == expectedPv .Spec .PersistentVolumeReclaimPolicy {
448
448
framework .Logf ("PV %q reclaim policy is already recovered to %q" , expectedPv .Name , expectedPv .Spec .PersistentVolumeReclaimPolicy )
449
449
return nil
450
450
}
451
- pv .Spec .ClaimRef = nil
452
451
pv .Spec .PersistentVolumeReclaimPolicy = expectedPv .Spec .PersistentVolumeReclaimPolicy
453
452
_ , err = c .CoreV1 ().PersistentVolumes ().Update (ctx , pv , metav1.UpdateOptions {})
454
453
return err
0 commit comments