diff options
author | 2016-09-02 07:51:33 +0000 | |
---|---|---|
committer | 2016-09-02 07:51:33 +0000 | |
commit | 7cc12c9748cfc758aa5ac164dfb13b900ef9dd82 (patch) | |
tree | b6d5b9895a6cfb65b1f14b4e8aa3be692d865224 /vnfs/qemu/qemu.py | |
parent | b2289e1f6abab2d807eb55d9ec868039dc2384e2 (diff) | |
parent | 8a1a94321a26e34dc4c0b3ba9cd868487fa2c5ac (diff) |
Merge "vhost_affin_fixup: Change vhost thread from regex to pgrep usage"
Diffstat (limited to 'vnfs/qemu/qemu.py')
-rw-r--r-- | vnfs/qemu/qemu.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/vnfs/qemu/qemu.py b/vnfs/qemu/qemu.py index dd9ad818..2093cb3b 100644 --- a/vnfs/qemu/qemu.py +++ b/vnfs/qemu/qemu.py @@ -247,14 +247,13 @@ class IVnfQemu(IVnf): :return: None """ self._logger.info('Affinitizing VHOST Net threads.') - args1 = ['ps', 'ax'] + args1 = ['pgrep', 'vhost-'] process1 = subprocess.Popen(args1, stdout=subprocess.PIPE, shell=False) out = process1.communicate()[0] - processes = list() - for line in out.decode(locale.getdefaultlocale()[1]).split('\n'): - if re.search('\[vhost-(\d+)', line): - processes.append(re.match('\s*(\d+)', line).group(1)) + processes = out.decode(locale.getdefaultlocale()[1]).split('\n') + if processes[-1] == '': + processes.pop() # pgrep may return an extra line with no data self._logger.info('Found %s vhost net threads...', len(processes)) cpumap = S.getValue('VSWITCH_VHOST_CPU_MAP') |