@@ -328,7 +328,7 @@ func (v *volumeModifyTestSuite) DefineTests(driver storageframework.TestDriver,
328328 originPv := pv .DeepCopy ()
329329 pv .Spec .PersistentVolumeReclaimPolicy = v1 .PersistentVolumeReclaimRetain
330330 _ , err = f .ClientSet .CoreV1 ().PersistentVolumes ().Update (ctx , pv , metav1.UpdateOptions {})
331- ginkgo .DeferCleanup (recoverPvReclaimPolicyAndRemoveClaimRef , f .ClientSet , originPv )
331+ ginkgo .DeferCleanup (recoverPvReclaimPolicy , f .ClientSet , originPv )
332332 framework .ExpectNoError (err , "Failed to update PV %q reclaim policy" , pvName )
333333
334334 // The vac_protection_controller make sure there is a VolumeAttributesClass that is not used by any PVC/PV
@@ -369,7 +369,7 @@ func (v *volumeModifyTestSuite) DefineTests(driver storageframework.TestDriver,
369369
370370 ginkgo .By (fmt .Sprintf ("Deleting PV %q to make the vac unused for the PV" , newVAC .Name ))
371371 pv .Spec .PersistentVolumeReclaimPolicy = v1 .PersistentVolumeReclaimDelete
372- recoverPvReclaimPolicyAndRemoveClaimRef (ctx , f .ClientSet , pv )
372+ recoverPvReclaimPolicy (ctx , f .ClientSet , pv )
373373
374374 ginkgo .By (fmt .Sprintf ("Waiting for PV %q to be deleted" , pvName ))
375375 gomega .Eventually (func () bool {
@@ -432,8 +432,8 @@ func CleanupVAC(ctx context.Context, vac *storagev1beta1.VolumeAttributesClass,
432432 }, timeout , modifyPollInterval ).Should (gomega .BeNil ())
433433}
434434
435- // recoverPvReclaimPolicyAndRemoveClaimRef recovers the test pv's reclaim policy to expected used for clean up test PV
436- func recoverPvReclaimPolicyAndRemoveClaimRef (ctx context.Context , c clientset.Interface , expectedPv * v1.PersistentVolume ) {
435+ // recoverPvReclaimPolicy recovers the test pv's reclaim policy to expected used for clean up test PV
436+ func recoverPvReclaimPolicy (ctx context.Context , c clientset.Interface , expectedPv * v1.PersistentVolume ) {
437437 setPvReclaimPolicyErr := retry .RetryOnConflict (retry .DefaultRetry , func () error {
438438 pv , err := c .CoreV1 ().PersistentVolumes ().Get (ctx , expectedPv .Name , metav1.GetOptions {})
439439 if err != nil {
@@ -443,11 +443,10 @@ func recoverPvReclaimPolicyAndRemoveClaimRef(ctx context.Context, c clientset.In
443443 }
444444 return err
445445 }
446- if pv .Spec .PersistentVolumeReclaimPolicy == expectedPv .Spec .PersistentVolumeReclaimPolicy && pv . Spec . ClaimRef == nil {
446+ if pv .Spec .PersistentVolumeReclaimPolicy == expectedPv .Spec .PersistentVolumeReclaimPolicy {
447447 framework .Logf ("PV %q reclaim policy is already recovered to %q" , expectedPv .Name , expectedPv .Spec .PersistentVolumeReclaimPolicy )
448448 return nil
449449 }
450- pv .Spec .ClaimRef = nil
451450 pv .Spec .PersistentVolumeReclaimPolicy = expectedPv .Spec .PersistentVolumeReclaimPolicy
452451 _ , err = c .CoreV1 ().PersistentVolumes ().Update (ctx , pv , metav1.UpdateOptions {})
453452 return err
0 commit comments