Skip to content

Commit

Permalink
Merge pull request #3891 from dzhengfy/install_numactl_invm
Browse files Browse the repository at this point in the history
libvirt_memory: install numactl in vm
  • Loading branch information
chloerh authored Jun 28, 2024
2 parents b8d9ea7 + 3835ffd commit da1f1fe
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions virttest/utils_libvirt/libvirt_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from avocado.core import exceptions
from avocado.utils import process

from virttest import utils_package
from virttest.staging import utils_memory

LOG = logging.getLogger("avocado." + __name__)
Expand Down Expand Up @@ -79,6 +80,10 @@ def consume_vm_freememory(vm_session, consume_value=100000):
"""
vm_session.cmd_status("swapoff -a")
free_mem = utils_memory.freememtotal(vm_session)
if not utils_package.package_install("numactl", vm_session):
raise exceptions.TestError(
"Fail to install package 'numactl' which provides command 'memhog'"
)
cmd = "memhog %dk" % (free_mem - consume_value)
status, stdout = vm_session.cmd_status_output(cmd, timeout=60)
return (status, stdout)

0 comments on commit da1f1fe

Please sign in to comment.