Skip to content

Commit 20b7a53

Browse files
committed
remove garbage collector dead code
1 parent 30e8ca8 commit 20b7a53

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

ocp_resources/datavolume.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ def __init__(
9191
yaml_file=None,
9292
delete_timeout=TIMEOUT_4MINUTES,
9393
api_name="pvc",
94-
delete_after_completion=None,
9594
**kwargs,
9695
):
9796
"""
@@ -121,7 +120,6 @@ def __init__(
121120
yaml_file (yaml, default: None): yaml file for the resource.
122121
delete_timeout (int, default: 4 minutes): timeout associated with delete action.
123122
api_name (str, default: "pvc"): api used for DV, pvc/storage
124-
delete_after_completion (str, default: None): annotation for garbage collector - "true"/"false"
125123
"""
126124
super().__init__(
127125
name=name,
@@ -148,7 +146,6 @@ def __init__(
148146
self.bind_immediate_annotation = bind_immediate_annotation
149147
self.preallocation = preallocation
150148
self.api_name = api_name
151-
self.delete_after_completion = delete_after_completion
152149

153150
def to_dict(self) -> None:
154151
super().to_dict()
@@ -196,10 +193,6 @@ def to_dict(self) -> None:
196193
}
197194
if self.preallocation is not None:
198195
self.res["spec"]["preallocation"] = self.preallocation
199-
if self.delete_after_completion:
200-
self.res["metadata"].setdefault("annotations", {}).update({
201-
f"{self.api_group}/storage.deleteAfterCompletion": (self.delete_after_completion)
202-
})
203196

204197
def wait_deleted(self, timeout=TIMEOUT_4MINUTES):
205198
"""
@@ -244,7 +237,6 @@ def scratch_pvc(self):
244237
def _check_none_pending_status(self, failure_timeout=TIMEOUT_2MINUTES):
245238
# Avoid waiting for "Succeeded" status if DV's in Pending/None status
246239
sample = None
247-
# if garbage collector is enabled, DV will be deleted after success
248240
try:
249241
for sample in TimeoutSampler(
250242
wait_timeout=failure_timeout,
@@ -270,18 +262,16 @@ def wait_for_dv_success(
270262
self,
271263
timeout=TIMEOUT_10MINUTES,
272264
failure_timeout=TIMEOUT_2MINUTES,
273-
dv_garbage_collection_enabled=False,
274265
stop_status_func=None,
275266
*stop_status_func_args,
276267
**stop_status_func_kwargs,
277268
):
278269
"""
279-
Wait until DataVolume succeeded with or without DV Garbage Collection enabled
270+
Wait until DataVolume succeeded
280271
281272
Args:
282273
timeout (int): Time to wait for the DataVolume to succeed.
283274
failure_timeout (int): Time to wait for the DataVolume to have not Pending/None status
284-
dv_garbage_collection_enabled (bool, default: False): if True, expect that DV will disappear after success
285275
stop_status_func (function): function that is called inside the TimeoutSampler
286276
if it returns True - stop the Sampler and raise TimeoutExpiredError
287277
Example:
@@ -307,11 +297,8 @@ def test_dv():
307297
wait_timeout=timeout,
308298
func=lambda: self.exists,
309299
):
310-
# DV reach success if the status is Succeeded, or if DV garbage collection enabled and the DV does not exist
311300
if sample and sample.get("status", {}).get("phase") == self.Status.SUCCEEDED:
312301
break
313-
elif sample is None and dv_garbage_collection_enabled:
314-
break
315302
elif stop_status_func and stop_status_func(*stop_status_func_args, **stop_status_func_kwargs):
316303
raise TimeoutExpiredError(
317304
value=(
@@ -339,8 +326,5 @@ def delete(self, wait=False, timeout=TIMEOUT_4MINUTES, body=None):
339326
Returns:
340327
bool: True if delete succeeded, False otherwise.
341328
"""
342-
# if garbage collector is enabled, DV will be deleted after success
343329
if self.exists:
344330
return super().delete(wait=wait, timeout=timeout, body=body)
345-
else:
346-
return self.pvc.delete(wait=wait, timeout=timeout, body=body)

0 commit comments

Comments
 (0)