Skip to content

Commit

Permalink
KSMConfig.cleanup: Ensure ksm to be disabled at the end of the case
Browse files Browse the repository at this point in the history
In the `cleanup` function, "start_ksmtuned" will start the
ksmtuned.service, it controls and tunes the ksm service, but depends on
the KSM_MONITOR_INTERVAL. So ksm is not closed immediately, but at some
time in KSM_MONITOR_INTERVAL loop. Without this fix, the next test case
may launch the guest with ksm enabled, which is not expected.

Signed-off-by: Yihuang Yu <[email protected]>
  • Loading branch information
PaulYuuu committed Jul 4, 2023
1 parent 1c4b016 commit a41e37e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion virttest/test_setup/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ def __init__(self, params, env):
if self.run == "yes":
self.run = "1"
elif self.run == "no":
self.run == "0"
self.run = "0"

# Get KSM module status if there is one
self.ksmctler = utils_misc.KSMController()
Expand Down Expand Up @@ -695,6 +695,12 @@ def cleanup(self, env):
# ksmtuned used to run in host. Start the process
# and don't need set up the configures.
self.ksmctler.start_ksmtuned()
# Ensure ksm it not enabled before return
if not wait.wait_for(lambda: not self.ksmctler.is_ksm_running(),
timeout=120, step=5,
text="Waiting for ksm to be disabled"):
LOG.warning("KSM is still running, subsequent test may not "
"work as expected")
return

if default_status == self.default_status:
Expand Down

0 comments on commit a41e37e

Please sign in to comment.