Skip to content

Commit

Permalink
Merge pull request autotest#5212 from liang-cong-red-hat/lcong-br
Browse files Browse the repository at this point in the history
memory_binding_setting: Add cgroup v1 adaption for cpuset.mems
  • Loading branch information
dzhengfy authored Nov 2, 2023
2 parents ec8c659 + fef9dc2 commit defa57d
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from virttest import test_setup
from virttest.libvirt_xml import vm_xml
from virttest.utils_test import libvirt
from virttest.utils_libvirt import libvirt_numa

from provider.numa import numa_base

Expand Down Expand Up @@ -176,25 +177,25 @@ def verify_cgroup(test_obj):
"""
mem_mode = test_obj.params.get('mem_mode')
nodeset = numa_base.convert_to_string_with_dash(test_obj.params.get('nodeset'))
online_nodes = libvirt_numa.parse_numa_nodeset_to_str('x-y', test_obj.online_nodes)
vm_pid = test_obj.vm.get_pid()
cg = libvirt_cgroup.CgroupTest(vm_pid)
surfix = 'emulator/cpuset.mems' if cg.is_cgroup_v2_enabled() else 'cpuset.mems'
cpuset_mems_cgroup_path = os.path.join(cg.get_cgroup_path(controller='cpuset'), surfix)
cmd = 'cat %s' % re.escape(cpuset_mems_cgroup_path)
cpuset_mems = process.run(cmd, shell=True).stdout_text.strip()
if mem_mode in ['strict', 'restrictive']:
if cpuset_mems != nodeset:
test_obj.test.fail("Expect cpuset.mems in "
"path '%s' to be %s, but "
"found '%s'" % (cpuset_mems_cgroup_path,
nodeset,
cpuset_mems))
expected_cpuset_mems = nodeset
elif cg.is_cgroup_v2_enabled():
expected_cpuset_mems = ""
else:
if cpuset_mems:
test_obj.test.fail("Expect cpuset.mems in "
"path '%s' to be '', but "
"found '%s'" % (cpuset_mems_cgroup_path,
cpuset_mems))
expected_cpuset_mems = online_nodes
if cpuset_mems != expected_cpuset_mems:
test_obj.test.fail("Expect cpuset.mems in "
"path '%s' to be %s, but "
"found '%s'" % (cpuset_mems_cgroup_path,
expected_cpuset_mems,
cpuset_mems))
test_obj.test.log.debug("Step: verify cgroup information PASS")


Expand Down

0 comments on commit defa57d

Please sign in to comment.