Merge lp:~codehelp/lava-dispatcher/multinode-docs-update into lp:lava-dispatcher/multinode

Proposed by Neil Williams
Status: Merged
Approved by: Neil Williams
Approved revision: 691
Merged at revision: 690
Proposed branch: lp:~codehelp/lava-dispatcher/multinode-docs-update
Merge into: lp:lava-dispatcher/multinode
Diff against target: 723 lines (+369/-52)
5 files modified
doc/debugging.rst (+119/-0)
doc/multinode.rst (+51/-0)
doc/multinodeapi.rst (+18/-0)
doc/usecaseone.rst (+95/-38)
doc/usecasetwo.rst (+86/-14)
To merge this branch: bzr merge lp:~codehelp/lava-dispatcher/multinode-docs-update
Reviewer Review Type Date Requested Status
Milo Casagrande (community) Approve
Review via email: mp+181775@code.launchpad.net

Description of the change

This is the update containing the docs as shown in the demo.

To post a comment you must log in.
Revision history for this message
Milo Casagrande (milo) wrote :

It looked good on the demo, and going through it I do not see anything broken or wrong.
So, +1 from me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'doc/debugging.rst'
--- doc/debugging.rst 1970-01-01 00:00:00 +0000
+++ doc/debugging.rst 2013-08-23 10:36:27 +0000
@@ -0,0 +1,119 @@
1.. _debugging:
2
3Debugging LAVA test definitions
4*******************************
5
6.. _singlenode:
7
8Convert Multi-Node jobs to single node
9======================================
10
11The scripts available in the :ref:`multinode_api` are not installed for
12test jobs which are not part of a MultiNode group, so the job will simply
13fail that test as a ``command not found``.
14
15Therefore, by reversing the :ref:`changes_to_json`, a MultiNode JSON file
16can be converted to singlenode.
17
18Other calls which may require communication with other devices may need
19to be removed from your YAML. This can be extended to retain a set of
20singlenode YAML files in which new wrapper scripts and new builds are
21tested.
22
23The Job Definition of one job within a MultiNode group may be a good
24starting point for creating a singlenode equivalent.
25
26.. _set_x:
27
28Always use set -x in wrapper scripts
29====================================
30
31By viewing the complete log, the complete processing of the wrapper script
32becomes obvious.
33
34::
35
36 #!/bin/sh
37 set -e
38 set -x
39
40.. _shell_operators:
41
42Avoid using shell operators in YAML lines
43=========================================
44
45Pipes, redirects and nested sub shells will not work reliably when put
46directly into the YAML. Use a wrapper script (with :ref:`set -x <set_x>`).
47
48::
49
50 #!/bin/sh
51
52 set -e
53 set -x
54 ifconfig|grep "inet addr"|grep -v "127.0.0.1"|cut -d: -f2|cut -d' ' -f1
55
56Un-nested sub-shells do work::
57
58 - lava-test-case multinode-send-network --shell lava-send network hostname=$(hostname) fqdn=$(hostname -f)
59
60.. _check_messageid:
61
62Check that your message ID labels are consistent
63================================================
64
65A :ref:`lava_wait` must be preceded by a :ref:`lava_send` from at least
66one other device in the group or the waiting device will :ref:`timeout <timeouts>`
67
68This can be a particular problem if you remove test definitions from the
69JSON or edit a YAML file without checking other uses of the same file.
70
71``#`` can be used as a comment in YAML but JSON does not support
72comments, so take care.
73
74.. _parsers:
75
76Test your result parsers
77========================
78
79If the YAML uses a custom result parser, configure one of your YAML files
80to output the entire test result output to stdout so that you can
81reliably capture a representative block of output. Test your proposed
82result parser against the block using your favourite language.
83
84Comment out the parser from the YAML if there are particular problems,
85just to see what the default LAVA parsers can provide.
86
87.. _paths:
88
89Be obsessive about paths and scripts
90====================================
91
92* If you use ``cd`` in your YAML, always store where you were and where you end up using ``pwd``.
93* Output your location prior to calling local wrapper scripts.
94* Ensure that all wrapper scripts are executable in your VCS
95* Ensure that the relevant interpreter is installed. e.g. python is not necessarily part of the test image.
96* Consider installing ``realpath`` and use that to debug your directory structure.
97 * Avoid the temptation of using absolute paths - LAVA may need to change the absolute locations.
98
99.. _failed_tests:
100
101A failed test is not necessarily a bug in the test
102==================================================
103
104Always check whether the test result came back as failed due to some
105cause other than the test definition itself. Particularly with MultiNode,
106a test result can fail due to some problem on a different board within
107the group.
108
109.. _json_files:
110
111Check your JSON files
112=====================
113
114Syntax problems will be picked up by LAVA when you submit but also check
115that the URLs listed in the JSON are correct. Keep your YAML descriptions,
116names and filenames unique so that it is easier to pick up if the JSON
117simply calls the wrong YAML test definition.
118
119
0120
=== modified file 'doc/multinode.rst'
--- doc/multinode.rst 2013-08-19 10:36:07 +0000
+++ doc/multinode.rst 2013-08-23 10:36:27 +0000
@@ -29,6 +29,7 @@
2929
30 multinodeapi.rst30 multinodeapi.rst
31 multinode-usecases.rst31 multinode-usecases.rst
32 debugging.rst
3233
33Hardware requirements and virtualisation34Hardware requirements and virtualisation
34****************************************35****************************************
@@ -70,6 +71,8 @@
70If more than one, but not all, roles share one particular action, that action will need to be repeated71If more than one, but not all, roles share one particular action, that action will need to be repeated
71within the JSON file, once for each role using that action.72within the JSON file, once for each role using that action.
7273
74.. _changes_to_json:
75
73Changes to submission JSON76Changes to submission JSON
74==========================77==========================
7578
@@ -159,6 +162,8 @@
159or a lava-wait will fail on any node which waits longer than the default timeout. The node will receive a failure162or a lava-wait will fail on any node which waits longer than the default timeout. The node will receive a failure
160response.163response.
161164
165.. _timeouts:
166
162Recommendations on timeouts167Recommendations on timeouts
163===========================168===========================
164169
@@ -178,6 +183,52 @@
178waiting jobs have already failed due to a problem elsewhere in the group. If timeouts are too short,183waiting jobs have already failed due to a problem elsewhere in the group. If timeouts are too short,
179jobs will fail unnecessarily.184jobs will fail unnecessarily.
180185
186Balancing timeouts
187^^^^^^^^^^^^^^^^^^
188
189Individual actions and commands can have differing timeouts, so avoid the temptation to change the
190default timeout when a particular action times out in a Multi-Node job. If a particular ``lava-test-shell``
191takes a long time, set an explicit timeout for that particular action:
192
193::
194
195 {
196 "timeout": 900,
197 "job_name": "netperf multinode tests",
198 "logging_level": "DEBUG",
199 }
200
201
202::
203
204 {
205 "command": "lava_test_shell",
206 "parameters": {
207 "testdef_repos": [
208 {
209 "git-repo": "git://git.linaro.org/people/guoqing.zhu/netperf-multinode.git",
210 "testdef": "netperf-multinode-c-network.yaml"
211 }
212 ],
213 "timeout": 2400,
214 "role": "client"
215 }
216 },
217 {
218 "command": "lava_test_shell",
219 "parameters": {
220 "testdef_repos": [
221 {
222 "git-repo": "git://git.linaro.org/people/guoqing.zhu/netperf-multinode.git",
223 "testdef": "netperf-multinode-s-network.yaml"
224 }
225 ],
226 "timeout": 1800,
227 "role": "server"
228 }
229 },
230
231
181Running a server on the device-under-test232Running a server on the device-under-test
182*****************************************233*****************************************
183234
184235
=== modified file 'doc/multinodeapi.rst'
--- doc/multinodeapi.rst 2013-08-19 10:36:07 +0000
+++ doc/multinodeapi.rst 2013-08-23 10:36:27 +0000
@@ -1,3 +1,5 @@
1.. _multinode_api:
2
1MultiNode API3MultiNode API
2=============4=============
35
@@ -6,6 +8,8 @@
6definitions which need to transfer files, long messages or other large amounts of data need to set up their8definitions which need to transfer files, long messages or other large amounts of data need to set up their
7own network configuration, access and download methods and do the transfer in the test definition.9own network configuration, access and download methods and do the transfer in the test definition.
810
11.. _lava_self:
12
9lava-self13lava-self
10---------14---------
1115
@@ -13,6 +17,8 @@
1317
14Usage: ``lava-self``18Usage: ``lava-self``
1519
20.. _lava_role:
21
16lava-role22lava-role
17---------23---------
1824
@@ -25,6 +31,8 @@
2531
26 $ ./run-$(lava-role)32 $ ./run-$(lava-role)
2733
34.. _lava-group:
35
28lava-group36lava-group
29----------37----------
3038
@@ -42,6 +50,8 @@
42 highbank02 backend50 highbank02 backend
43 highbank03 backend51 highbank03 backend
4452
53.. _lava_send:
54
45lava-send55lava-send
46---------56---------
4757
@@ -55,6 +65,8 @@
55Examples will be provided below, together with ``lava-wait`` and65Examples will be provided below, together with ``lava-wait`` and
56``lava-wait-all``.66``lava-wait-all``.
5767
68.. _lava_wait:
69
58lava-wait70lava-wait
59---------71---------
6072
@@ -75,6 +87,8 @@
75will be returned by subsequent calls to ``lava-wait`` for that message87will be returned by subsequent calls to ``lava-wait`` for that message
76ID. Use a different message ID to collate different message data.88ID. Use a different message ID to collate different message data.
7789
90.. _lava_wait_all:
91
78lava-wait-all92lava-wait-all
79-------------93-------------
8094
@@ -108,6 +122,8 @@
108As with ``lava-wait``, the message ID is persistent for the duration of122As with ``lava-wait``, the message ID is persistent for the duration of
109the MultiNode group.123the MultiNode group.
110124
125.. _lava_sync:
126
111lava-sync127lava-sync
112---------128---------
113129
@@ -119,6 +135,8 @@
119``lava-sync foo`` is effectively the same as ``lava-send foo`` followed135``lava-sync foo`` is effectively the same as ``lava-send foo`` followed
120by ``lava-wait-all foo``.136by ``lava-wait-all foo``.
121137
138.. _lava_network:
139
122lava-network140lava-network
123------------141------------
124142
125143
=== modified file 'doc/usecaseone.rst'
--- doc/usecaseone.rst 2013-08-19 10:36:07 +0000
+++ doc/usecaseone.rst 2013-08-23 10:36:27 +0000
@@ -1,34 +1,39 @@
1.. _use_case_one:
2
1Use Case One - Setting up a simple client:server test definition.3Use Case One - Setting up a simple client:server test definition.
2*****************************************************************4*****************************************************************
35
4One device needs to obtain / prepare some data and then make the data 6One device needs to obtain / prepare some data and then make the data
5available to another device in the same group.7available to another device in the same group.
68
7Source Code9Source Code
8===========10===========
911
10 * The YAML snippets in this example are not complete, for a working example of the code, see:12* The YAML snippets in this example are not complete, for a working example of the code, see:
1113
12 https://git.linaro.org/gitweb?p=people/neilwilliams/multinode-yaml.git;a=blob_plain;f=forwarder.yaml;hb=refs/heads/master14 https://git.linaro.org/gitweb?p=people/neilwilliams/multinode-yaml.git;a=blob_plain;f=forwarder.yaml;hb=refs/heads/master
1315
14 https://git.linaro.org/gitweb?p=people/neilwilliams/multinode-yaml.git;a=blob_plain;f=receiver.yaml;hb=refs/heads/master16 https://git.linaro.org/gitweb?p=people/neilwilliams/multinode-yaml.git;a=blob_plain;f=receiver.yaml;hb=refs/heads/master
1517
16 https://git.linaro.org/gitweb?p=people/neilwilliams/multinode-yaml.git;a=blob_plain;f=json/kvm-beagleblack-group.json;hb=HEAD18 https://git.linaro.org/gitweb?p=people/neilwilliams/multinode-yaml.git;a=blob_plain;f=json/beagleblack-use-case.json;hb=HEAD
1719
18Requirements20Requirements
19============21============
2022
21 * A mechanism to obtain the data, presumably from some third-party source231. A mechanism to obtain the data, presumably from some third-party source
22 * A sync to ensure that the file is ready to be offered to the other device242. A sync to ensure that the file is ready to be offered to the other device
23 * This ensures that the attempt to receive does not start early25
24 * A message to the original board that the data has been received and verified26 2.1. This ensures that the attempt to receive does not start early
25 * This ensures that any cleanup of the data does not happen before the transfer is complete.27
283. A message to the original board that the data has been received and verified
29
30 3.1. This ensures that any cleanup of the data does not happen before the transfer is complete.
2631
27Methods32Methods
28=======33=======
2934
30 * Install a package which can obtain the data from the third party source35* Install a package which can obtain the data from the third party source
31 * Install a package which can provide the means to get the data to the other board36* Install a package which can provide the means to get the data to the other board
3237
33Control flow38Control flow
34============39============
@@ -66,8 +71,8 @@
66of the filter. To start each YAML file, ensure that the metadata contains71of the filter. To start each YAML file, ensure that the metadata contains
67two metadata fields:72two metadata fields:
6873
69 * format - **Lava-Test Test Definition 1.0**74* format : **Lava-Test Test Definition 1.0**
70 * description - your own descriptive text75* description : your own descriptive text
7176
72It is useful to also add the maintainer field with your email address77It is useful to also add the maintainer field with your email address
73as this will be needed later if the test is to be added to one of the78as this will be needed later if the test is to be added to one of the
@@ -82,10 +87,50 @@
82 maintainer:87 maintainer:
83 - neil.williams@linaro.org88 - neil.williams@linaro.org
8489
90Installing packages for use in a test
91-------------------------------------
92
93If your test image raises a usable network interface by default on boot,
94the YAML can specify a list of packages which need to be installed for
95this test definition:
96
97::
98
99 install:
100 deps:
101 - wget
102 - apache2
103
104If your test needs to raise the network interface itself, the package
105installation will need to be done in the run steps::
106
107 run:
108 steps:
109 - lava-test-case linux-linaro-ubuntu-route-ifconfig-up --shell ifconfig eth0 up
110 - lava-test-case apt-update --shell apt-get update
111 - lava-test-case install-deps --shell apt-get -y install wget apache2
112
113Note that although KVM devices can use apt, the network interface fails
114the LAVA test, so use the manual install steps for non-bridged KVM devices.
85115
86Preparing the test to send data116Preparing the test to send data
87-------------------------------117-------------------------------
88118
119``modify-data.sh`` would, presumably, unpack the data, modify it in
120some way and pack it back up again. In this example, it would be a no-op
121but note that it still needs to exist in the top level directory of your
122VCS repo and be executable.
123
124Any packages required by ``modify-data.sh`` need to be added to the install
125deps of sender.yaml. Providing useful contents of ``modify-data.sh`` is
126left as an exercise for the reader.
127
128Modification happens before the :ref:`lava_sync` ``download`` which tells the
129receiver that the data is ready to be transferred.
130
131The sender then waits for the receiver to acknowledge a correct download
132using :ref:`lava_sync` ``received`` and cleans up.
133
89sender.yaml134sender.yaml
90^^^^^^^^^^^135^^^^^^^^^^^
91136
@@ -98,7 +143,6 @@
98143
99 run:144 run:
100 steps:145 steps:
101 - lava-test-case linux-linaro-ubuntu-route-ifconfig-up --shell ifconfig eth0 up
102 - lava-test-case multinode-network --shell lava-network broadcast eth0146 - lava-test-case multinode-network --shell lava-network broadcast eth0
103 - lava-test-case wget-file --shell wget -O /var/www/testfile http://releases.linaro.org/latest/android/arndale/userdata.tar.bz2147 - lava-test-case wget-file --shell wget -O /var/www/testfile http://releases.linaro.org/latest/android/arndale/userdata.tar.bz2
104 - ./modify-data.sh148 - ./modify-data.sh
@@ -112,12 +156,10 @@
112The receiver needs to know where to find the data. The sender can ensure that the156The receiver needs to know where to find the data. The sender can ensure that the
113file is in a particular location, it is up to the YAML to get the rest of the157file is in a particular location, it is up to the YAML to get the rest of the
114information of the network address of the sender. This example assumes that the158information of the network address of the sender. This example assumes that the
115data is modified in some undisclosed manner by the ```./modify-data.sh```159data is modified in some undisclosed manner by the ``./modify-data.sh``
116script which is part of your testdef_repo before the receiver is notified.160script which is part of your testdef_repo before the receiver is notified.
117Any packages required by ```modify-data.sh``` need to be added to the install
118deps of sender.yaml. The contents of ```modify-data.sh``` are left as an exercise for the reader.
119161
120The LAVA MultiNode API provides ways of querying the network information of devices162The LAVA :ref:`multinode_api` provides ways of querying the network information of devices
121within the group. In order to offer the data via apache, the sender needs to163within the group. In order to offer the data via apache, the sender needs to
122raise a suitable network interface, so it calls ifconfig as a lava test case164raise a suitable network interface, so it calls ifconfig as a lava test case
123first and then uses the lava-network API call to broadcast network information165first and then uses the lava-network API call to broadcast network information
@@ -159,33 +201,40 @@
159get-data.sh201get-data.sh
160^^^^^^^^^^^202^^^^^^^^^^^
161203
204Always use **set -x** in any wrapper / helper scripts which you expect
205to use in a test run to be able to debug test failures.
206
207Ensure that the scripts are marked as executable in your VCS and
208that the appropriate interpreter is installed in your test image.
209
162::210::
163211
164 #!/bin/sh212 #!/bin/sh
165 set -e213 set -e
166 DEVICE=`lava-group | grep -m1 -v kvm|cut -f2`214 set -x
215 DEVICE=`lava-group | grep -m1 receiver|cut -f2`
167 SOURCE=`lava-network query $DEVICE ipv4|grep -v LAVA|cut -d: -f2`216 SOURCE=`lava-network query $DEVICE ipv4|grep -v LAVA|cut -d: -f2`
168 wget -O /tmp/testfile http://${SOURCE}/testfile217 wget -O /tmp/testfile http://${SOURCE}/testfile
169218
170219
171The ```$DEVICE``` simply matches the first device name in this group220The ``$DEVICE`` simply matches the first device name in this group
172which contains the string 'kvm' and returns the full name of that device,221which contains the string 'receiver' (which comes from the ``role``
173e.g. multinode-kvm02222specified in the JSON) and returns the full name of that device,
223e.g. multinode-kvm02 or staging-beagleblack03
174224
175This device name is then passed to lava-network query to get the ipv4225This device name is then passed to lava-network query to get the ipv4
176details of that device within this group. The value of ```$SOURCE```226details of that device within this group. The value of ``$SOURCE``
177is an IPv4 address of the sender (assuming that your JSON has defined a227is an IPv4 address of the sender (assuming that your JSON has defined a
178device_type for the sender as a device which would contain228role for the sender which would contain the 'receiver' string in the name.)
179the 'kvm' string in the name.)
180229
181Finally, ```get-data.sh``` does the work of receiving the data from230Finally, ``get-data.sh`` does the work of receiving the data from
182the sender. The verification of the data is left as an exercise for231the sender. The verification of the data is left as an exercise for
183the reader - one simple method would be for the sender to checksum the232the reader - one simple method would be for the sender to checksum the
184(modified) data and use ```lava-send``` to make that checksum available233(modified) data and use ``lava-send`` to make that checksum available
185to devices within the group. The receiver can then use ```lava-wait```234to devices within the group. The receiver can then use ``lava-wait``
186to get that checksum.235to get that checksum.
187236
188Once ```get-data.sh``` returns, the receiver notifies the sender that237Once ``get-data.sh`` returns, the receiver notifies the sender that
189the transfer is complete, processes the data as it sees fit and cleans up.238the transfer is complete, processes the data as it sees fit and cleans up.
190239
191Preparing the JSON240Preparing the JSON
@@ -193,7 +242,7 @@
193242
194The JSON ties the YAML test definition with the hardware and software to243The JSON ties the YAML test definition with the hardware and software to
195run the test definition. The JSON is also where multiple test244run the test definition. The JSON is also where multiple test
196definitions are combined into a single !MultiNode test.245definitions are combined into a single MultiNode test.
197246
198General settings247General settings
199----------------248----------------
@@ -289,8 +338,7 @@
289If any action has no role specified, it will be actioned for all roles.338If any action has no role specified, it will be actioned for all roles.
290339
291For Use Case One, we have a different YAML file for each role, so340For Use Case One, we have a different YAML file for each role, so
292we have two lava_test_shell commands. (The content happens to be the341we have two lava_test_shell commands.
293same in this example.)
294342
295::343::
296344
@@ -326,7 +374,8 @@
326^^^^^^^^^^^^^^374^^^^^^^^^^^^^^
327375
328The results for the entire group get aggregated into a single result376The results for the entire group get aggregated into a single result
329bundle.377bundle. Ensure that the bundle stream exists on the specified server
378and that you have permission to add to that stream.
330379
331::380::
332381
@@ -334,7 +383,7 @@
334 {383 {
335 "command": "submit_results_on_host",384 "command": "submit_results_on_host",
336 "parameters": {385 "parameters": {
337 "stream": "/anonymous/instance-manager/",386 "stream": "/anonymous/use-cases/",
338 "server": "http://validation.linaro.org/RPC2/"387 "server": "http://validation.linaro.org/RPC2/"
339 }388 }
340 }389 }
@@ -343,7 +392,7 @@
343Prepare a filter for the results392Prepare a filter for the results
344================================393================================
345394
346Now decide how your are going to analyse the results of tests using395Now decide how you are going to analyse the results of tests using
347this definition, using the name of the test definition specified in396this definition, using the name of the test definition specified in
348the YAML metadata.397the YAML metadata.
349398
@@ -385,7 +434,7 @@
385434
386On the website for the instance running the tests, click on Dashboard435On the website for the instance running the tests, click on Dashboard
387and Filters. If you have permissions, there will be a link entitled436and Filters. If you have permissions, there will be a link entitled
388*Add new filter...*. 437*Add new filter...*.
389438
390The filter name should include most of the data about what this filter439The filter name should include most of the data about what this filter
391is intended to do, without whitespace. This name will be preserved through440is intended to do, without whitespace. This name will be preserved through
@@ -406,13 +455,13 @@
406455
407Within a test definition, a filter can also select only particular test456Within a test definition, a filter can also select only particular test
408cases. In this Use Case, for example, the filter could choose only the457cases. In this Use Case, for example, the filter could choose only the
409```multinode-network```, ```multinode-get-network``` or ```file-sync```458``multinode-network``, ``multinode-get-network`` or ``file-sync``
410test cases. Continue to add tests and/or test cases - the more tests459test cases. Continue to add tests and/or test cases - the more tests
411and/or test cases are added to the filter, the fewer results will460and/or test cases are added to the filter, the fewer results will
412match.461match.
413462
414Click the *Preview* button to apply the filter to the current set of463Click the *Preview* button to apply the filter to the current set of
415results **without saving the filter**. 464results **without saving the filter**.
416465
417In the preview, if there are columns with no data or rows with no data466In the preview, if there are columns with no data or rows with no data
418for specific columns, these will show up as missing data in the filter467for specific columns, these will show up as missing data in the filter
@@ -450,7 +499,7 @@
450499
451The full version of this use case are available:500The full version of this use case are available:
452501
453http://git.linaro.org/gitweb?p=people/neilwilliams/multinode-yaml.git;a=blob_plain;f=json/kvm-beagleblack-group.json;hb=refs/heads/master502http://git.linaro.org/gitweb?p=people/neilwilliams/multinode-yaml.git;a=blob_plain;f=json/kvm-beagleblack-group.json;hb=HEAD
454503
455Example test results are visible here:504Example test results are visible here:
456505
@@ -462,3 +511,11 @@
462did not have a bridged configuration, so the internal networking of the kvm meant511did not have a bridged configuration, so the internal networking of the kvm meant
463that although the KVM could connect to the beaglebone-black, the beaglebone-black512that although the KVM could connect to the beaglebone-black, the beaglebone-black
464could not connect to the kvm.513could not connect to the kvm.
514
515https://git.linaro.org/gitweb?p=people/neilwilliams/multinode-yaml.git;a=blob_plain;f=json/beagleblack-use-case.json;hb=HEAD
516
517https://staging.validation.linaro.org/dashboard/image-reports/beagleblack-usecase
518
519https://staging.validation.linaro.org/dashboard/streams/anonymous/codehelp/bundles/cf4eb9e0022232e97aaec2737b3cd436cd37ab14/
520
521This example uses two beaglebone-black devices.
465522
=== modified file 'doc/usecasetwo.rst'
--- doc/usecasetwo.rst 2013-08-19 10:36:07 +0000
+++ doc/usecasetwo.rst 2013-08-23 10:36:27 +0000
@@ -1,3 +1,5 @@
1.. _use_case_two:
2
1Use Case Two - Setting up the same job on multiple devices3Use Case Two - Setting up the same job on multiple devices
2**********************************************************4**********************************************************
35
@@ -7,7 +9,7 @@
7Source Code9Source Code
8===========10===========
911
10The test definition itself could be an unchanged singlenode test definition, e.g. 12The test definition itself could be an unchanged singlenode test definition, e.g.
1113
12 https://git.linaro.org/gitweb?p=qa/test-definitions.git;a=blob_plain;f=ubuntu/smoke-tests-basic.yaml;hb=refs/heads/master14 https://git.linaro.org/gitweb?p=qa/test-definitions.git;a=blob_plain;f=ubuntu/smoke-tests-basic.yaml;hb=refs/heads/master
1315
@@ -30,10 +32,9 @@
30Preparing the YAML32Preparing the YAML
31==================33==================
3234
33In this use case, the same YAML file is to be used to test multiple devices.35In the first part of this use case, the same YAML file is to be used to
34Select your YAML file and, if appropriate, edit the name in the metadata.36test multiple devices. Select your YAML file and, if appropriate, edit
3537the name in the metadata.
36TBD: MultiNode API
3738
38Preparing the JSON39Preparing the JSON
39===================40===================
@@ -41,8 +42,8 @@
41The change from a standard single-node JSON file is to expand the device_type42The change from a standard single-node JSON file is to expand the device_type
42or device field to a device_group.43or device field to a device_group.
4344
44The change for multiple devices in MultiNode is within the ```device_group```. To run the test45The change for multiple devices in MultiNode is within the ``device_group``. To run the test
45multiple devices of the same type, simply increase the ```count``:46multiple devices of the same type, simply increase the ``count``:
4647
47::48::
4849
@@ -55,15 +56,15 @@
55 "tags": [56 "tags": [
56 "use-case-two"57 "use-case-two"
57 ]58 ]
58 } 59 }
59 }60 }
6061
61If the rest of the JSON refers to a ```role``` other than the one specified62If the rest of the JSON refers to a ``role`` other than the one specified
62in the ```device_group```, those JSON sections are ignored.63in the ``device_group``, those JSON sections are ignored.
6364
64If other actions in the JSON do not mention a ```role```, the action will65If other actions in the JSON do not mention a ``role``, the action will
65occur on all devices in the ```device_group```. So with a single role,66occur on all devices in the ``device_group``. So with a single role,
66it only matters that a role exists in the ```device_group```.67it only matters that a role exists in the ``device_group``.
6768
68actions69actions
69-------70-------
@@ -136,13 +137,84 @@
136Prepare a filter for the results137Prepare a filter for the results
137================================138================================
138139
139The filter for this use case uses a ```required attribute``` 140The filter for this use case uses a ``required attribute``
140of **target.device_type** to only show results for the specified141of **target.device_type** to only show results for the specified
141devices (to cover reuse of the YAML on other boards later).142devices (to cover reuse of the YAML on other boards later).
142143
143It is also possible to add a second filter which matches a specific **target**144It is also possible to add a second filter which matches a specific **target**
144device.145device.
145146
147Adding synchronisation
148======================
149
150So far, the multiple devices have been started together but then had no
151further interaction.
152
153The :ref:`multinode_api` supports communication between devices within
154a group and provides synchronisation primitives. The simplest of these
155primitives, :ref:`lava_sync` was used in :ref:`use_case_one` but there are more
156possibilities available.
157
158:ref:`lava_sync` is a special case of a :ref:`lava_send` followed by a
159:ref:`lava_wait_all`.
160
161Sending messages
162----------------
163
164Messages can be sent using :ref:`lava_send` which is a non-blocking call.
165At a later point, another device in the group can collect the message
166using ``lava-wait`` or ``lava-wait-all`` which will block until
167the message is available.
168
169The message can be a simple identifier (e.g. 'download' or 'ready') and
170is visible to all devices in the group.
171
172Key value pairs can also be sent using the API to broadcast particular
173information.
174
175If multiple devices send the same message ID, the data is collated by
176the LAVA Coordinator. Key value pairs sent with any message ID are
177tagged with the device name which sent the key value pairs.
178
179Receiving messages
180------------------
181
182Message reception will block until the message is available.
183
184For :ref:`lava_wait`, the message is deemed available as soon as any device
185in the group has sent a message with the matching ID. If no devices have
186sent such a message, any device asking for ``lava-wait`` on that ID
187will block until a different board uses ``lava-send`` with the expected
188message ID.
189
190For :ref:`lava_wait_all`, the message is only deemed available if **all
191devices in the group** have already sent a message with the expected message
192ID. Therefore, using ``lava-wait-all`` requires a preceding
193``lava-send``.
194
195When using ``lava-wait-all MESSAGEID ROLE``, the message is only deemed
196available if **all devices with the matching role in the group** have
197sent a message with the expected message ID. If the receiving device has
198the specified role, that device must use a ``lava-send`` for the same
199message ID before using ``lava-wait-all MESSAGEID ROLE``.
200
201::
202
203 - lava-test-case multinode-send-network --shell lava-send ready
204 - lava-test-case multinode-get-network --shell lava-wait ready
205
206It is up to the test writer to ensure that when :ref:`lava_wait` is used,
207that the message ID is sufficiently unique that the first use of that
208message ID denotes the correct point in the YAML.
209
210::
211
212 - 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)
213 - lava-test-case multinode-wait-message --shell lava-wait-all sending
214
215This example will wait until all devices in the group have sent the
216message ID ''sending'' (with or without the associated key value pairs).
217
146Summary218Summary
147=======219=======
148220

Subscribers

People subscribed via source and target branches

to status/vote changes: