get_running_processes: don't list 'kernel' as a pid

fuser shows some of kernel accesses (mount points, swap files, etc)
using the string 'kernel' as a pid. Ignore such a pseudo-pid to
avoid the spurious errors and noise in the logs.

This CR effectively re-applies #245654 [0] which was merged 
five days ago, but was accidentally reverted by #246575 [1] 
due to some unknown issues during merge to master.
This could easily be seen from commit to master on GitHub [2]
[0] - https://review.openstack.org/#/c/245654
[1] - https://review.openstack.org/#/c/246575
[2] - c33563d561

Change-Id: Ia0cb7ef41812d854b53e52fbb4e06fd86622fb87
This commit is contained in:
alexz 2015-11-22 22:42:06 +02:00 committed by Aleksey Zvyagintsev
parent 1d98edb046
commit 88c993eab9
1 changed files with 4 additions and 2 deletions

View File

@ -220,8 +220,10 @@ def stop_chrooted_processes(chroot, signal=sig.SIGTERM,
raise ValueError('Signal must be either SIGTERM or SIGKILL')
def get_running_processes():
return utils.execute(
'fuser', '-v', chroot, check_exit_code=False)[0].split()
# fuser shows *some* (mount point, swap file) accesses by
# the kernel using the string 'kernel' as a pid, ignore these
out, _ = utils.execute('fuser', '-v', chroot, check_exit_code=False)
return [pid for pid in out.split() if pid != 'kernel']
for i in six.moves.range(attempts):
running_processes = get_running_processes()