diff --git a/ocp_resources/datavolume.py b/ocp_resources/datavolume.py index d088a7510e..b32b3cc0d9 100644 --- a/ocp_resources/datavolume.py +++ b/ocp_resources/datavolume.py @@ -91,7 +91,6 @@ def __init__( yaml_file=None, delete_timeout=TIMEOUT_4MINUTES, api_name="pvc", - delete_after_completion=None, **kwargs, ): """ @@ -121,7 +120,6 @@ def __init__( yaml_file (yaml, default: None): yaml file for the resource. delete_timeout (int, default: 4 minutes): timeout associated with delete action. api_name (str, default: "pvc"): api used for DV, pvc/storage - delete_after_completion (str, default: None): annotation for garbage collector - "true"/"false" """ super().__init__( name=name, @@ -148,7 +146,6 @@ def __init__( self.bind_immediate_annotation = bind_immediate_annotation self.preallocation = preallocation self.api_name = api_name - self.delete_after_completion = delete_after_completion def to_dict(self) -> None: super().to_dict() @@ -196,10 +193,6 @@ def to_dict(self) -> None: } if self.preallocation is not None: self.res["spec"]["preallocation"] = self.preallocation - if self.delete_after_completion: - self.res["metadata"].setdefault("annotations", {}).update({ - f"{self.api_group}/storage.deleteAfterCompletion": (self.delete_after_completion) - }) def wait_deleted(self, timeout=TIMEOUT_4MINUTES): """ @@ -244,7 +237,6 @@ def scratch_pvc(self): def _check_none_pending_status(self, failure_timeout=TIMEOUT_2MINUTES): # Avoid waiting for "Succeeded" status if DV's in Pending/None status sample = None - # if garbage collector is enabled, DV will be deleted after success try: for sample in TimeoutSampler( wait_timeout=failure_timeout, @@ -270,18 +262,16 @@ def wait_for_dv_success( self, timeout=TIMEOUT_10MINUTES, failure_timeout=TIMEOUT_2MINUTES, - dv_garbage_collection_enabled=False, stop_status_func=None, *stop_status_func_args, **stop_status_func_kwargs, ): """ - Wait until DataVolume succeeded with or without DV Garbage Collection enabled + Wait until DataVolume succeeded 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 stop_status_func (function): function that is called inside the TimeoutSampler if it returns True - stop the Sampler and raise TimeoutExpiredError Example: @@ -307,11 +297,8 @@ def test_dv(): wait_timeout=timeout, func=lambda: self.exists, ): - # 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 - elif sample is None and dv_garbage_collection_enabled: - break elif stop_status_func and stop_status_func(*stop_status_func_args, **stop_status_func_kwargs): raise TimeoutExpiredError( value=( @@ -339,8 +326,5 @@ def delete(self, wait=False, timeout=TIMEOUT_4MINUTES, body=None): Returns: bool: True if delete succeeded, False otherwise. """ - # if garbage collector is enabled, DV will be deleted after success if self.exists: - return super().delete(wait=wait, timeout=timeout, body=body) - else: - return self.pvc.delete(wait=wait, timeout=timeout, body=body) + return super().delete(wait=wait, timeout=timeout, body=body) \ No newline at end of file