Skip to content

Commit c41b34e

Browse files
authored
Update VMI pause/unpause (#2596)
removed wait_for_domstate_pause_status from pause/unpause (when called with wait=True): 1. check for domstate was an old w/a with is irrelevant now 2. executing domstate command on virt-launhcer pod can be done only with admin client (even though pause/unpause can be executed by unpriv client)
1 parent 8a04c62 commit c41b34e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

ocp_resources/virtual_machine_instance.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import shlex
22
from typing import Any
3+
from warnings import warn
34

45
import xmltodict
56
from kubernetes.dynamic.exceptions import ResourceNotFoundError
@@ -154,10 +155,14 @@ def wait_for_pause_status(self, pause, timeout=TIMEOUT_4MINUTES):
154155
TimeoutExpiredError: If resource not exists.
155156
"""
156157
self.logger.info(f"Wait until {self.kind} {self.name} is {'Paused' if pause else 'Unpuased'}")
157-
self.wait_for_domstate_pause_status(pause=pause, timeout=timeout)
158158
self.wait_for_vmi_condition_pause_status(pause=pause, timeout=timeout)
159159

160160
def wait_for_domstate_pause_status(self, pause, timeout=TIMEOUT_4MINUTES):
161+
warn(
162+
message="wait_for_domstate_pause_status is deprecated and will be removed the next version.",
163+
category=DeprecationWarning,
164+
stacklevel=2,
165+
)
161166
pause_status = "paused" if pause else "running"
162167
samples = TimeoutSampler(
163168
wait_timeout=timeout,
@@ -272,6 +277,11 @@ def get_domstate(self):
272277
Returns:
273278
String: VMI Status as string
274279
"""
280+
warn(
281+
message="get_domstate is deprecated and will be removed the next version.",
282+
category=DeprecationWarning,
283+
stacklevel=2,
284+
)
275285
return self.execute_virsh_command(command="domstate")
276286

277287
def get_dommemstat(self):

0 commit comments

Comments
 (0)