Differences between revisions 29 and 30
Revision 29 as of 2013-05-15 15:50:21
Size: 5991
Editor: c-67-173-255-225
Comment:
Revision 30 as of 2013-05-15 18:48:36
Size: 1647
Editor: c-67-173-255-225
Comment: Copy-Paste commands moved to a new page
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Commands to copy/paste to deploy LAVA =
You can use this series of commands to create your own local instance of LAVA; create a default QEMU device/device-type, create sample testscript and create and schedule your first LAVA job.
= LAVA VM disk image for training =
Line 4: Line 3:
You can perform these steps in a VM (one provided below), natively on your system.

== LAVA VM used for training ==
== Download the VM ==
Line 22: Line 19:
 ssh lava@localhost -p 2222 $ ssh lava@localhost -p 2222
Line 25: Line 22:
 sudo apt-get install bzr

}}}
----
# You may need to login
# bzr launchpad-login <launchpad.net login id>
## make sure your public key is uploaded
## make sure your .ssh/config .ssh/id_rsa... is configured properly, etc...
----
{{{
$ sudo apt-get install bzr
Line 37: Line 25:
 bzr branch lp:lava-deployment-tool
 cd lava-deployment-tool
$ bzr branch lp:lava-deployment-tool
$ cd lava-deployment-tool
Line 41: Line 29:
 ./lava-deployment-tool setup -n $ ./lava-deployment-tool setup -n
Line 44: Line 32:
 ./lava-deployment-tool install -n mylava $ ./lava-deployment-tool install -n mylava
Line 46: Line 34:
}}}
----
# create administrator users  {user: admin, password: admin}
 ./lava-deployment-tool manage mylava createsuperuser
----
{{{
# create administrator users
$ ./lava-deployment-tool manage mylava createsuperuser
Line 54: Line 38:
 sudo apt-get install qemu-system $ sudo apt-get install qemu-system
Line 57: Line 41:
 mkdir /srv/lava/instances/mylava/etc/lava-dispatcher/devices
 echo "device_type = qemu" > /srv/lava/instances/mylava/etc/lava-dispatcher/devices/qemu01.conf
$ cd /srv/lava/instances/mylava
$ mkdir
etc/lava-dispatcher/devices
$ cd etc/lava-dispatcher/devices
$ nano
qemu01.conf
$
cd
Line 61: Line 48:
 sudo apt-get install lava-scheduler-tool lava-dashboard-tool

### This section creates an API key
lavaaddr=localhost
lavaurl=http://$lavaaddr
adminuser=admin
adminpass=admin

#obtain the csrf token
data=$(curl -s -c cookies.txt $lavaurl/accounts/login/ | grep -o "name=['\"]csrfmiddlewaretoken['\"] value=['\"][^'\"]*" | sed -e "s/name='//" -e "s/' value='/=/")

#login
login=$data\&username=$adminuser\&password=$adminpass
curl -b cookies.txt -c cookies.txt -d $login -X POST $lavaurl/accounts/login/

#create an api key
createapi=$data\&description=autogenerated
curl -b cookies.txt -c cookies.txt -d $createapi -X POST $lavaurl/api/tokens/create/

#get the api key(s)
curl -b cookies.txt -c cookies.txt -d $data $lavaurl/api/tokens/ | grep secret
$ sudo apt-get install lava-scheduler-tool lava-dashboard-tool
Line 84: Line 51:
lava-tool auth-add http://$adminuser@$lavaaddr/RPC2/
}}}
----
Copy and paste one of the keys (text between <code> and </code>

# IF you are using a desktop Ubuntu installation, python and gnome keyring can cause problems if you execute over ssh. (gnomekeyring.IO error) To get around this you can configure the keyringrc.cfg file to use a file instead.
----
{{{
mkdir ~/.cache/keyring
echo '
[backend]
default-keyring=keyring.backend.CryptedFileKeyring
keyring-path=~/.cache/keyring/
' > ~/keyringrc.cfg
}}}
----
{{{
$ lava-dashboard-tool auth-add http://admin@localhost/RPC2/
Line 104: Line 54:
lava-tool make-stream --dashboard-url http://$adminuser@$lavaaddr/RPC2/ /anonymous/qemu/

# configure device type and device
# Add new device type "qemu"
## http://localhost/admin/lava_scheduler_app/devicetype/add/
createdevicetype=$data\&name=qemu\&display=1
curl -b cookies.txt -c cookies.txt -d $createdevicetype -X POST $lavaurl/admin/lava_scheduler_app/devicetype/add/

# Add new device "qemu01" of device type "qemu"
## http://localhost/admin/lava_scheduler_app/device/add/
createdevice=$data\&hostname=qemu01\&device_type=qemu\&device_version=1\&status=1\&health_status=0
curl -b cookies.txt -c cookies.txt -d $createdevice -X POST $lavaurl/admin/lava_scheduler_app/device/add/


######
# store files in lava sub directory
cd; lavadir=`pwd`/lava
mkdir $lavadir

#######
# get qemu test image: /home/userx/lava/beagle-nano.img.gz
wget http://releases.linaro.org/images/12.03/oneiric/nano/beagle-nano.img.gz -O $lavadir/beagle-nano.img.gz --no-check-certificate

#######
# create test shell file: ~/lava/lava-test-shell-simple.yaml
####################################################
############ lava-test-shell-simple.yaml ###########
####################################################
echo '
metadata:
  name: lava-test-shell-simple
  description: Simple test to validate deployment
  version: 1.0
  format: "Lava-Test-Shell Test Definition 1.0"

run:
  steps:
    - lava-test-case yeah-it-works --result pass

parse:
  pattern: "^\\s*(?P<test_case_id>\\w+)=(?P<result>\\w+)\\s*$"
' > $lavadir/lava-test-shell-simple.yaml;
#######
# create job file: ~/lava/qemu.json
####################################################
##################### qemu.json ####################
####################################################
echo '
{
  "timeout": 1800,
  "job_name": "qemu-test",
  "device_type": "qemu",
  "logging_level": "DEBUG",
  "actions": [
    {
      "command": "deploy_linaro_image",
      "parameters": {
        "image": "file://'$lavadir'/beagle-nano.img.gz"
        }
    },
    {
      "command": "lava_test_shell",
      "parameters": {
        "timeout": 1800,
        "testdef_urls": [
            "file://'$lavadir'/lava-test-shell-simple.yaml"
        ]
      }
    },
    {
        "command": "submit_results",
        "parameters": {
            "stream": "/anonymous/qemu/",
            "server": "http://'$adminuser'@'$lavaaddr'/RPC2/"
        }
    }
  ]
}
' > $lavadir/qemu.json;
lava-dashboard-tool make-stream --dashboard-url http://admin@localhost/RPC2/ /anonymous/qemu/
Line 185: Line 57:
lava-tool submit-job http://$adminuser@$lavaaddr/RPC2/ $lavadir/qemu.json
$ lava-dashboard-tool submit-job http://admin@localhost/RPC2/ qemu.json
Line 188: Line 59:

Now Open up a browser and watch the execution in the LAVA scheduler
where localhost = hostname or IP of lava installation
http://localhost/scheduler/job/1

LAVA VM disk image for training

Download the VM

VM DISK IMAGE DOWNLOAD

SHA1SUM: ac7fd95d3e408fd8aa0f4428e76a39cdbb54b1b7

Slide sets

Commands for copy and paste

# connecting to the VM
$ ssh lava@localhost -p 2222

# install bzr
$ sudo apt-get install bzr

# get lava-deployment-tool
$ bzr branch lp:lava-deployment-tool
$ cd lava-deployment-tool

# setup the system
$ ./lava-deployment-tool setup -n

# install lava instance
$ ./lava-deployment-tool install -n mylava

# create administrator users
$ ./lava-deployment-tool manage mylava createsuperuser

# install QEMU
$ sudo apt-get install qemu-system

# Create device configuration file
$ cd /srv/lava/instances/mylava
$ mkdir etc/lava-dispatcher/devices
$ cd etc/lava-dispatcher/devices
$ nano qemu01.conf
$ cd

# install client tools
$ sudo apt-get install lava-scheduler-tool lava-dashboard-tool

# authenticate to the API
$ lava-dashboard-tool auth-add http://admin@localhost/RPC2/

# create bundle stream
lava-dashboard-tool make-stream --dashboard-url http://admin@localhost/RPC2/ /anonymous/qemu/

# submit a job 
$ lava-dashboard-tool submit-job http://admin@localhost/RPC2/ qemu.json

Platform/LAVA/TrainingVM (last modified 2013-05-15 20:37:44)