aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lava_scheduler_app/dbutils.py6
-rw-r--r--lava_scheduler_app/tests/master-multinode.json63
-rw-r--r--lava_scheduler_app/tests/test_submission.py18
3 files changed, 86 insertions, 1 deletions
diff --git a/lava_scheduler_app/dbutils.py b/lava_scheduler_app/dbutils.py
index a7233895f..8100304c6 100644
--- a/lava_scheduler_app/dbutils.py
+++ b/lava_scheduler_app/dbutils.py
@@ -152,6 +152,9 @@ def testjob_submission(job_definition, user, check_device=None):
allow_health = True
try:
job = TestJob.from_json_and_user(job_definition, user, health_check=allow_health)
+ if isinstance(job, list):
+ # multinode health checks not supported
+ return job
job.health_check = allow_health
if check_device:
job.requested_device = check_device
@@ -217,7 +220,6 @@ def find_device_for_job(job, device_list): # pylint: disable=too-many-branches
if job.requested_device and job.requested_device.status == Device.OFFLINE:
logger.debug("[%s] - assigning %s for forced health check.", job.id, job.requested_device)
return job.requested_device
- logger.debug("[%s] Finding a device from a list of %s", job.id, len(device_list))
for device in device_list:
if job.is_vmgroup:
# special handling, tied directly to the TestJob within the vmgroup
@@ -410,6 +412,8 @@ def assign_jobs():
reserved_devices = []
# this takes a significant amount of time when under load, only do it once per tick
devices = list(get_available_devices())
+ logger.debug("[%d] devices available", len(devices))
+ logger.debug("[%d] jobs in the queue", len(jobs))
# a forced health check can be assigned even if the device is not in the list of idle devices.
for job in jobs:
device = find_device_for_job(job, devices)
diff --git a/lava_scheduler_app/tests/master-multinode.json b/lava_scheduler_app/tests/master-multinode.json
new file mode 100644
index 000000000..f6c7350f0
--- /dev/null
+++ b/lava_scheduler_app/tests/master-multinode.json
@@ -0,0 +1,63 @@
+{
+ "timeout": 900,
+ "job_name": "test multinode submission",
+ "logging_level": "INFO",
+ "vm_group": {
+ "host": {
+ "device_type": "beaglebone-black",
+ "role": "host"
+ },
+ "auto_start_vms": false,
+ "vms": [{
+ "device_type": "kvm-aarch64",
+ "role": "guest-nonsecure"
+ }, {
+ "device_type": "kvm-aarch64",
+ "role": "guest-secure"
+ }, {
+ "device_type": "kvm-aarch64",
+ "role": "guest-grub-secure"
+ }]
+ },
+ "actions": [{
+ "command": "deploy_linaro_kernel",
+ "parameters": {
+ "dtb": "",
+ "kernel": "",
+ "nfsrootfs": "",
+ "target_type": "ubuntu",
+ "role": "host"
+ }
+ }, {
+ "command": "deploy_linaro_kernel",
+ "parameters": {
+ "kernel": "",
+ "ramdisk": "",
+ "firmware": "",
+ "role": "guest-nonsecure"
+ }
+ }, {
+ "command": "deploy_linaro_kernel",
+ "parameters": {
+ "kernel": "",
+ "ramdisk": "",
+ "role": "guest-secure"
+ }
+ }, {
+ "command": "deploy_linaro_kernel",
+ "parameters": {
+ "kernel": "",
+ "rootfs": "",
+ "role": "guest-grub-secure"
+ }
+ }, {
+ "command": "lava_test_shell",
+ "parameters": {
+ "testdef_repos": [{
+ "url": "https://git.linaro.org/ci/uefi.git/blob_plain/HEAD:/lava/kvm-install-qemu-host.yaml"
+ }],
+ "timeout": 1800,
+ "role": "host"
+ }
+ }]
+} \ No newline at end of file
diff --git a/lava_scheduler_app/tests/test_submission.py b/lava_scheduler_app/tests/test_submission.py
index c8ed7a4b4..c75a0b364 100644
--- a/lava_scheduler_app/tests/test_submission.py
+++ b/lava_scheduler_app/tests/test_submission.py
@@ -24,6 +24,7 @@ from lava_scheduler_app.models import (
JSONDataError,
Tag,
TestJob,
+ TemporaryDevice,
DevicesUnavailableException,
DeviceDictionary,
_check_exclusivity,
@@ -983,6 +984,23 @@ actions:
def_dict['target'] = 'nosuchdevice'
definition = json.dumps(def_dict)
self.assertRaises(Device.DoesNotExist, testjob_submission, definition, user)
+ # check multinode API submission. bug #2130
+ filename = os.path.join(os.path.dirname(__file__), 'master-multinode.json')
+ self.assertTrue(os.path.exists(filename))
+ with open(filename, 'r') as json_file:
+ definition = json_file.read()
+ job_list = testjob_submission(definition, user)
+ self.assertIsInstance(job_list, list)
+ for job in job_list:
+ self.assertIsNotNone(job.vm_group)
+ self.assertFalse(job.health_check)
+ if job.requested_device_type == device_type:
+ self.assertIsNone(job.requested_device)
+ else:
+ self.assertIsNotNone(job.requested_device)
+ self.assertIsInstance(job.requested_device, TemporaryDevice)
+ job.requested_device.delete()
+ job.delete()
class TransactionTestCaseWithFactory(TransactionTestCase):