Skip to content

Commit

Permalink
Merge pull request #3705 from PaulYuuu/ksm-release
Browse files Browse the repository at this point in the history
KSMConfig.cleanup: Ensure ksm to be disabled at the end of the case
  • Loading branch information
YongxueHong committed Jul 11, 2023
2 parents 7e880ed + a41e37e commit e20d6f4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion virttest/test_setup/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,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 @@ -697,6 +697,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
3 changes: 2 additions & 1 deletion virttest/utils_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3084,7 +3084,8 @@ def is_ksm_running(self):
Verify whether ksm is running.
"""
if self.interface == "sysfs":
running = process.run("cat %s" % self.ksm_params["run"]).stdout_text
running = process.run(
"cat %s" % self.ksm_params["run"]).stdout_text.strip()
else:
output = process.run("ksmctl info").stdout_text
try:
Expand Down

0 comments on commit e20d6f4

Please sign in to comment.