aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lava_scheduler_app/schema.py31
-rw-r--r--lava_scheduler_app/tests/lxc-multinode.yaml59
-rw-r--r--lava_scheduler_app/tests/test_pipeline.py21
-rwxr-xr-xlava_scheduler_app/utils.py9
4 files changed, 111 insertions, 9 deletions
diff --git a/lava_scheduler_app/schema.py b/lava_scheduler_app/schema.py
index 2ca3a1d27..e457ab55a 100644
--- a/lava_scheduler_app/schema.py
+++ b/lava_scheduler_app/schema.py
@@ -175,6 +175,27 @@ def vlan_name(value):
raise Invalid(value)
+def lxc_protocol_schema():
+ return Schema({
+ str: {
+ 'name': str,
+ 'distribution': str,
+ 'release': str,
+ 'arch': str,
+ 'template': str,
+ 'mirror': str,
+ 'security_mirror': str
+ },
+ 'name': str,
+ 'distribution': str,
+ 'release': str,
+ 'arch': str,
+ 'template': str,
+ 'mirror': str,
+ 'security_mirror': str
+ })
+
+
def _job_protocols_schema():
return Schema({
'lava-multinode': {
@@ -190,15 +211,7 @@ def _job_protocols_schema():
}
}
},
- 'lava-lxc': {
- 'name': str,
- 'distribution': str,
- 'release': str,
- 'arch': str,
- 'template': str,
- 'mirror': str,
- 'security_mirror': str
- }
+ 'lava-lxc': lxc_protocol_schema()
})
diff --git a/lava_scheduler_app/tests/lxc-multinode.yaml b/lava_scheduler_app/tests/lxc-multinode.yaml
new file mode 100644
index 000000000..77bf96d45
--- /dev/null
+++ b/lava_scheduler_app/tests/lxc-multinode.yaml
@@ -0,0 +1,59 @@
+device_type: lxc
+job_name: lxc-pipeline
+timeouts:
+ job:
+ minutes: 15
+ action:
+ minutes: 5
+priority: medium
+visibility: public
+visibility: public
+
+protocols:
+ lava-multinode:
+ roles:
+ client:
+ count: 1
+ device_type: lxc
+ server:
+ count: 1
+ device_type: qemu
+ lava-lxc:
+ client:
+ name: pipeline-lxc-test
+ template: debian
+ distribution: debian
+ release: sid
+ arch: amd64
+ mirror: http://ftp.us.debian.org/debian/
+ security_mirror: http://mirror.csclub.uwaterloo.ca/debian-security/
+
+actions:
+- deploy:
+ timeout:
+ minutes: 5
+ role:
+ - client
+ to: lxc
+ os: debian
+
+- boot:
+ role:
+ - client
+ prompts:
+ - 'root@(.*):/#'
+ timeout:
+ minutes: 5
+ method: lxc
+
+- test:
+ role:
+ - client
+ - server
+ timeout:
+ minutes: 5
+ definitions:
+ - repository: git://git.linaro.org/qa/test-definitions.git
+ from: git
+ path: common/dmidecode.yaml
+ name: dmidecode
diff --git a/lava_scheduler_app/tests/test_pipeline.py b/lava_scheduler_app/tests/test_pipeline.py
index 7e9cc0664..243729eaf 100644
--- a/lava_scheduler_app/tests/test_pipeline.py
+++ b/lava_scheduler_app/tests/test_pipeline.py
@@ -698,6 +698,27 @@ class TestYamlMultinode(TestCaseWithFactory):
else:
self.fail('unexpected role')
+ def test_multinode_lxc(self):
+ submission = yaml.load(open(
+ os.path.join(os.path.dirname(__file__), 'lxc-multinode.yaml'), 'r'))
+ target_group = 'arbitrary-group-id' # for unit tests only
+
+ jobs = split_multinode_yaml(submission, target_group)
+ protocol_data = {
+ 'lava-lxc': {
+ 'name': 'pipeline-lxc-test', 'template': 'debian',
+ 'security_mirror': 'http://mirror.csclub.uwaterloo.ca/debian-security/', 'release': 'sid',
+ 'distribution': 'debian', 'mirror': 'http://ftp.us.debian.org/debian/', 'arch': 'amd64'}
+ }
+ for role, _ in jobs.iteritems():
+ if role == 'server':
+ self.assertNotIn('lava-lxc', jobs[role][0]['protocols'])
+ elif role == 'client':
+ self.assertIn('lava-lxc', jobs[role][0]['protocols'])
+ self.assertEqual(jobs[role][0]['protocols']['lava-lxc'], protocol_data['lava-lxc'])
+ else:
+ self.fail('Unrecognised role: %s' % role)
+
def test_multinode_protocols(self):
user = self.factory.make_user()
device_type = self.factory.make_device_type()
diff --git a/lava_scheduler_app/utils.py b/lava_scheduler_app/utils.py
index 836e8e8bc..20fbd0b40 100755
--- a/lava_scheduler_app/utils.py
+++ b/lava_scheduler_app/utils.py
@@ -873,6 +873,15 @@ def split_multinode_yaml(submission, target_group): # pylint: disable=too-many-
# populate the lava-vland protocol metadata
if 'lava-vland' in submission['protocols']:
_split_multinode_vland(submission, jobs)
+
+ # populate the lava-lxc protocol data
+ if 'lava-lxc' in submission['protocols']:
+ for role, _ in jobs.iteritems():
+ if role not in submission['protocols']['lava-lxc']:
+ continue
+ # populate the lava-vland protocol metadata
+ jobs[role][0]['protocols'].update({'lava-lxc': submission['protocols']['lava-lxc'][role]})
+
return jobs