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
This commit is contained in:
parent
8d82cbe0d6
commit
824805d91d
|
@ -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('\\', '\\\\') +
|
||||
|
|
Loading…
Reference in New Issue