1
.. index:: multiple devices
5
Use Case Two - Setting up the same job on multiple devices
6
**********************************************************
8
One test definition (or one set of test definitions) to be run on
9
multiple devices of the same device type.
14
The test definition itself could be an unchanged singlenode test definition, e.g.
16
https://git.linaro.org/qa/test-definitions.git/blob/HEAD:/ubuntu/smoke-tests-basic.yaml
18
Alternatively, it could use the MultiNode API to synchronise the devices, e.g.
20
https://git.linaro.org/people/neil.williams/multinode-yaml.git/blob_plain/HEAD:/multinode01.yaml
22
https://git.linaro.org/people/neil.williams/multinode-yaml.git/blob_plain/HEAD:/multinode02.yaml
24
https://git.linaro.org/people/neil.williams/multinode-yaml.git/blob_plain/HEAD:/multinode03.yaml
29
* Multiple devices running the same test definition.
30
* Running multiple test definitions at the same time on all devices in the group.
31
* Synchronising multiple devices during a test.
32
* Filter the results by device name.
37
In the first part of this use case, the same YAML file is to be used to
38
test multiple devices. Select your YAML file and, if appropriate, edit
39
the name in the metadata.
44
The change from a standard single-node JSON file is to expand the device_type
45
or device field to a device_group.
47
The change for multiple devices in MultiNode is within the ``device_group``. To run the test
48
multiple devices of the same type, simply increase the ``count``:
57
"device_type": "panda"
61
If the rest of the JSON refers to a ``role`` other than the one specified
62
in the ``device_group``, those JSON sections are ignored.
64
If other actions in the JSON do not mention a ``role``, the action will
65
occur on all devices in the ``device_group``. So with a single role,
66
it only matters that a role exists in the ``device_group``.
75
"command": "deploy_linaro_image",
77
"image": "https://releases.linaro.org/13.03/ubuntu/panda/panda-quantal_developer_20130328-278.img.gz"
86
To run multiple test definitions from one or multiple testdef repositories,
87
expand the testdef_repos array:
89
.. tip:: Remember the JSON syntax.
91
- continuations need commas, completions do not.
97
"command": "lava_test_shell",
101
"git-repo": "git://git.linaro.org/people/neilwilliams/multinode-yaml.git",
102
"testdef": "multinode01.yaml"
105
"git-repo": "git://git.linaro.org/people/neilwilliams/multinode-yaml.git",
106
"testdef": "multinode02.yaml"
109
"git-repo": "git://git.linaro.org/people/neilwilliams/multinode-yaml.git",
110
"testdef": "multinode03.yaml"
121
The results for the entire group get aggregated into a single result
128
"command": "submit_results_on_host",
130
"stream": "/anonymous/instance-manager/",
131
"server": "http://validation.linaro.org/RPC2/"
136
Prepare a filter for the results
137
================================
139
The filter for this use case uses a ``required attribute``
140
of **target.device_type** to only show results for the specified
141
devices (to cover reuse of the YAML on other boards later).
143
It is also possible to add a second filter which matches a specific **target**
146
Adding synchronisation
147
======================
149
So far, the multiple devices have been started together but then had no
152
The :ref:`multinode_api` supports communication between devices within
153
a group and provides synchronisation primitives. The simplest of these
154
primitives, :ref:`lava_sync` was used in :ref:`use_case_one` but there are more
155
possibilities available.
157
:ref:`lava_sync` is a special case of a :ref:`lava_send` followed by a
158
:ref:`lava_wait_all`.
163
Messages can be sent using :ref:`lava_send` which is a non-blocking call.
164
At a later point, another device in the group can collect the message
165
using ``lava-wait`` or ``lava-wait-all`` which will block until
166
the message is available.
168
The message can be a simple identifier (e.g. 'download' or 'ready') and
169
is visible to all devices in the group.
171
Key value pairs can also be sent using the API to broadcast particular
174
If multiple devices send the same message ID, the data is collated by
175
the LAVA Coordinator. Key value pairs sent with any message ID are
176
tagged with the device name which sent the key value pairs.
181
Message reception will block until the message is available.
183
For :ref:`lava_wait`, the message is deemed available as soon as any device
184
in the group has sent a message with the matching ID. If no devices have
185
sent such a message, any device asking for ``lava-wait`` on that ID
186
will block until a different board uses ``lava-send`` with the expected
189
For :ref:`lava_wait_all`, the message is only deemed available if **all
190
devices in the group** have already sent a message with the expected message
191
ID. Therefore, using ``lava-wait-all`` requires a preceding
194
When using ``lava-wait-all MESSAGEID ROLE``, the message is only deemed
195
available if **all devices with the matching role in the group** have
196
sent a message with the expected message ID. If the receiving device has
197
the specified role, that device must use a ``lava-send`` for the same
198
message ID before using ``lava-wait-all MESSAGEID ROLE``.
202
- lava-test-case multinode-send-network --shell lava-send ready
203
- lava-test-case multinode-get-network --shell lava-wait ready
205
It is up to the test writer to ensure that when :ref:`lava_wait` is used,
206
that the message ID is sufficiently unique that the first use of that
207
message ID denotes the correct point in the YAML.
211
- lava-test-case multinode-send-message --shell lava-send sending source=$(lava-self) role=$(lava-role) hostname=$(hostname -f) kernver=$(uname -r) kernhost=$(uname -n)
212
- lava-test-case multinode-wait-message --shell lava-wait-all sending
214
This example will wait until all devices in the group have sent the
215
message ID ``sending`` (with or without the associated key value pairs).
220
http://git.linaro.org/people/neil.williams/multinode-yaml.git/blob_plain/HEAD:/json/panda-only-group.json
222
http://multinode.validation.linaro.org/dashboard/image-reports/panda-multinode