Skip to content

Commit 033de85

Browse files
committed
lib/vm: Add check for power action features
In theory, is_management_agent_up needs to check for all management agent features required by the tests. This includes the poweroff and reboot features. Signed-off-by: Tu Dinh <[email protected]>
1 parent 86e904b commit 033de85

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/vm.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,21 @@ def is_ssh_up(self):
157157
return False
158158

159159
def is_management_agent_up(self):
160+
"""Check for management agent features required by the tests."""
160161
return (
161162
self.param_get("PV-drivers-version", "major", accept_unknown_key=True) is not None
162163
# HACK: workaround for Windows XS guest agents not updating major version after resume
163164
or self.param_get("PV-drivers-version", "xenbus", accept_unknown_key=True) is not None
165+
) and (
166+
# These checks are required to verify that the VM's support for power actions is really online. These
167+
# features are provided by a service independent from the management agent, and which starts after the PV
168+
# drivers have started.
169+
# Only check Windows VMs for this to avoid breaking power actions on old Linux VMs.
170+
not self.is_windows
171+
or (
172+
strtobool(self.param_get("other", "feature-poweroff", accept_unknown_key=True))
173+
and strtobool(self.param_get("other", "feature-reboot", accept_unknown_key=True))
174+
)
164175
)
165176

166177
def wait_for_os_booted(self):

0 commit comments

Comments
 (0)