From 824805d91dd877ded1244dfd276fe59812621ead Mon Sep 17 00:00:00 2001 From: Waldemar Znoinski Date: Thu, 21 Apr 2016 18:35:53 +0100 Subject: [PATCH] fix get_placement function to use ps and new cgroup path Change in path to cgroup that has vcpu placement information is required for the function to work properly when run on host VM with Ubuntu 14. This breaks this function run in a docker container where cgroup paths are different. get_placement function now uses ps instead of pgrep due to fact pgrep was picking up more than qemu/VM process - it was not filtering '/bin/sh pgrep...' line. Change-Id: I7772dee3f9cf8680a65681fe642eba6e0724f80e Closes-Bug: #1573157 --- .../tests/scenario/test_numa_topology.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/intel_nfv_ci_tests/tests/scenario/test_numa_topology.py b/intel_nfv_ci_tests/tests/scenario/test_numa_topology.py index 71c0c34..d0c0d89 100644 --- a/intel_nfv_ci_tests/tests/scenario/test_numa_topology.py +++ b/intel_nfv_ci_tests/tests/scenario/test_numa_topology.py @@ -124,14 +124,20 @@ class TestServerNumaBase(manager.NetworkScenarioTest): private_key=self.keypair['private_key']) def get_placement(self, vcpu): - out, _ = processutils.execute('pgrep --full %s' % self.instance['id'], - shell=True) + + out, _ = processutils.execute('ps -eo pid,cmd,args | awk \'/%s/ && ' + '!/grep/ {print $1}\'' % + self.instance['id'], shell=True) + if not out: return - cgroup, _ = processutils.execute('grep name /proc/%s/cgroup' + cgroup, _ = processutils.execute('grep cpuset /proc/%s/cgroup' % out.strip(), shell=True) cgroup = cgroup.split(":")[-1].strip() + if cgroup.index('emulator'): + cgroup = cgroup + '/..' placement = [] + for i in range(vcpu): cpus, _ = processutils.execute('cgget -n -v -r cpuset.cpus %s' % (cgroup.replace('\\', '\\\\') +