tests: Allow more VMs to be started in parallel
Check the number of CPUs to determine how many VMs can be started in parallel. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
d07ca835cb
commit
a6ba5cca45
1 changed files with 18 additions and 13 deletions
|
@ -10,6 +10,7 @@ from __future__ import print_function
|
||||||
import curses
|
import curses
|
||||||
import fcntl
|
import fcntl
|
||||||
import logging
|
import logging
|
||||||
|
import multiprocessing
|
||||||
import os
|
import os
|
||||||
import selectors
|
import selectors
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -213,21 +214,25 @@ def vm_next_step(_vm, scr, test_queue):
|
||||||
|
|
||||||
def check_vm_start(scr, sel, test_queue):
|
def check_vm_start(scr, sel, test_queue):
|
||||||
running = False
|
running = False
|
||||||
updated = False
|
|
||||||
for i in range(num_servers):
|
for i in range(num_servers):
|
||||||
if not vm[i]['proc']:
|
if vm[i]['proc']:
|
||||||
|
running = True
|
||||||
|
continue
|
||||||
|
|
||||||
# Either not yet started or already stopped VM
|
# Either not yet started or already stopped VM
|
||||||
if test_queue and vm[i]['cmd'] and num_vm_starting() < 2:
|
max_start = multiprocessing.cpu_count()
|
||||||
|
if max_start > 4:
|
||||||
|
max_start /= 2
|
||||||
|
num_starting = num_vm_starting()
|
||||||
|
if vm[i]['cmd'] and len(test_queue) > num_starting and \
|
||||||
|
num_starting < max_start:
|
||||||
scr.move(i + 1, 10)
|
scr.move(i + 1, 10)
|
||||||
scr.clrtoeol()
|
scr.clrtoeol()
|
||||||
scr.addstr(i + 1, 10, "starting VM")
|
scr.addstr(i + 1, 10, "starting VM")
|
||||||
updated = True
|
|
||||||
start_vm(vm[i], sel)
|
start_vm(vm[i], sel)
|
||||||
else:
|
return True, True
|
||||||
continue
|
|
||||||
|
|
||||||
running = True
|
return running, False
|
||||||
return running, updated
|
|
||||||
|
|
||||||
def vm_terminated(_vm, scr, sel, test_queue):
|
def vm_terminated(_vm, scr, sel, test_queue):
|
||||||
updated = False
|
updated = False
|
||||||
|
|
Loading…
Reference in a new issue