diff --git a/ocp_resources/datavolume.py b/ocp_resources/datavolume.py index d088a7510e..38627087f1 100644 --- a/ocp_resources/datavolume.py +++ b/ocp_resources/datavolume.py @@ -8,6 +8,12 @@ from ocp_resources.persistent_volume_claim import PersistentVolumeClaim from ocp_resources.resource import NamespacedResource, Resource from timeout_sampler import TimeoutExpiredError, TimeoutSampler +from warnings import warn + +gc_deprecation_warning = ( + "garbage collector is removed in version v1.62 and going to be deprecated", + DeprecationWarning, +) class DataVolume(NamespacedResource): @@ -281,7 +287,7 @@ def wait_for_dv_success( Args: timeout (int): Time to wait for the DataVolume to succeed. failure_timeout (int): Time to wait for the DataVolume to have not Pending/None status - dv_garbage_collection_enabled (bool, default: False): if True, expect that DV will disappear after success + dv_garbage_collection_enabled (bool, default: False): DV garbage collection is deprecated and removed in v4.19 stop_status_func (function): function that is called inside the TimeoutSampler if it returns True - stop the Sampler and raise TimeoutExpiredError Example: @@ -307,6 +313,8 @@ def test_dv(): wait_timeout=timeout, func=lambda: self.exists, ): + if dv_garbage_collection_enabled is not None: + warn(gc_deprecation_warning) # DV reach success if the status is Succeeded, or if DV garbage collection enabled and the DV does not exist if sample and sample.get("status", {}).get("phase") == self.Status.SUCCEEDED: break