mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
kvm_net: avoid shell when using Popen
This commit is contained in:
parent
aa8f1a59c4
commit
89e4dd6420
1 changed files with 3 additions and 3 deletions
|
@ -96,9 +96,9 @@ def fetch(vms):
|
|||
|
||||
def detect_kvm():
|
||||
""" Check if kvm is installed """
|
||||
kvm = Popen("which kvm", shell=True, stdout=PIPE)
|
||||
kvm = Popen(["which", "kvm"], stdout=PIPE)
|
||||
kvm.communicate()
|
||||
return not bool(kvm.returncode)
|
||||
return kvm.returncode == 0
|
||||
|
||||
|
||||
def find_vm_names(pids):
|
||||
|
@ -130,7 +130,7 @@ def list_pids():
|
|||
|
||||
@return a list of pids from running kvm
|
||||
"""
|
||||
pid = Popen("pidof qemu-kvm qemu-system-x86_64 kvm", shell=True, stdout=PIPE)
|
||||
pid = Popen(["pidof", "qemu-kvm", "qemu-system-x86_64", "kvm"], stdout=PIPE)
|
||||
return pid.communicate()[0].decode().split()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue