@@ -329,7 +329,7 @@ func (v *volumeModifyTestSuite) DefineTests(driver storageframework.TestDriver,
329329 originPv := pv .DeepCopy ()
330330 pv .Spec .PersistentVolumeReclaimPolicy = v1 .PersistentVolumeReclaimRetain
331331 _ , err = f .ClientSet .CoreV1 ().PersistentVolumes ().Update (ctx , pv , metav1.UpdateOptions {})
332- ginkgo .DeferCleanup (recoverPvReclaimPolicyAndRemoveClaimRef , f .ClientSet , originPv )
332+ ginkgo .DeferCleanup (recoverPvReclaimPolicy , f .ClientSet , originPv )
333333 framework .ExpectNoError (err , "Failed to update PV %q reclaim policy" , pvName )
334334
335335 // 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,
370370
371371 ginkgo .By (fmt .Sprintf ("Deleting PV %q to make the vac unused for the PV" , newVAC .Name ))
372372 pv .Spec .PersistentVolumeReclaimPolicy = v1 .PersistentVolumeReclaimDelete
373- recoverPvReclaimPolicyAndRemoveClaimRef (ctx , f .ClientSet , pv )
373+ recoverPvReclaimPolicy (ctx , f .ClientSet , pv )
374374
375375 ginkgo .By (fmt .Sprintf ("Waiting for PV %q to be deleted" , pvName ))
376376 gomega .Eventually (func () bool {
@@ -433,8 +433,8 @@ func CleanupVAC(ctx context.Context, vac *storagev1.VolumeAttributesClass, c cli
433433 }, timeout , modifyPollInterval ).Should (gomega .BeNil ())
434434}
435435
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 ) {
438438 setPvReclaimPolicyErr := retry .RetryOnConflict (retry .DefaultRetry , func () error {
439439 pv , err := c .CoreV1 ().PersistentVolumes ().Get (ctx , expectedPv .Name , metav1.GetOptions {})
440440 if err != nil {
@@ -444,11 +444,10 @@ func recoverPvReclaimPolicyAndRemoveClaimRef(ctx context.Context, c clientset.In
444444 }
445445 return err
446446 }
447- if pv .Spec .PersistentVolumeReclaimPolicy == expectedPv .Spec .PersistentVolumeReclaimPolicy && pv . Spec . ClaimRef == nil {
447+ if pv .Spec .PersistentVolumeReclaimPolicy == expectedPv .Spec .PersistentVolumeReclaimPolicy {
448448 framework .Logf ("PV %q reclaim policy is already recovered to %q" , expectedPv .Name , expectedPv .Spec .PersistentVolumeReclaimPolicy )
449449 return nil
450450 }
451- pv .Spec .ClaimRef = nil
452451 pv .Spec .PersistentVolumeReclaimPolicy = expectedPv .Spec .PersistentVolumeReclaimPolicy
453452 _ , err = c .CoreV1 ().PersistentVolumes ().Update (ctx , pv , metav1.UpdateOptions {})
454453 return err
0 commit comments