test-runner: set processor count for VM

For better reliability the processor count is now set to qemu.
In cases of low CPU count (< 2) hosts the processor count is
limited to 1. Otherwise half of the host cores will be used for
the VM.
This commit is contained in:
James Prestwood 2020-12-10 09:45:25 -08:00 committed by Denis Kenzior
parent d40cac403f
commit ada46fb2db
1 changed files with 14 additions and 1 deletions

View File

@ -1402,6 +1402,19 @@ class Main:
'kernel'
]
nproc = multiprocessing.cpu_count()
#
# Specially handle CPU systems with minimal cores, otherwise
# use half the host cores.
#
if nproc < 2:
smp = 1
else:
smp = int(nproc / 2)
print("Using %d cores for VM" % smp)
#
# This passes through most of the command line options to
# the kernel command line. Some are not relevant (e.g. qemu)
@ -1440,7 +1453,7 @@ class Main:
rootflags=trans=virtio,version=9p2000.u \
acpi=off pci=noacpi %s ro \
mac80211_hwsim.radios=0 %s' % (kern_log, options),
'-cpu', 'host'
'-cpu', 'host', '-smp', str(smp)
]
# Add two ethernet devices for testing EAD