Differences between revisions 20 and 21
Revision 20 as of 2013-05-10 18:43:31
Size: 4745
Editor: c-67-173-253-207
Comment:
Revision 21 as of 2013-05-10 19:04:33
Size: 5085
Editor: c-67-173-253-207
Comment:
Deletions are marked like this. Additions are marked like this.
Line 43: Line 43:
}}}
----
Line 45: Line 47:
----
{{{
Line 57: Line 61:
lavaurl=http://localhost 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='/=/")
Line 59: Line 70:
login=$data\&username=admin\&password=admin login=$data\&username=$adminuser\&password=$adminpass
Line 69: Line 80:
# authenticate to the API
lava-tool auth-add http://$adminuser@$lavaaddr/RPC2/
Line 71: Line 84:
# IF you are using a desktop Ubuntu installation, python and gnome keyring can cause problems if you execute over ssh. To get around this you can configure the keyringrc.cfg file to use a file instead. 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
Line 75: Line 93:
keyring-path=/home/akbennett/.cache/keyring/ keyring-path=~/.cache/keyring/
Line 77: Line 95:
----
{{{
# authenticate to the API
lava-tool auth-add http://admin@localhost/RPC2/
Line 82: Line 96:
----
copy and paste one of the keys (text between <code> and </code>
Line 89: Line 101:
lava-tool make-stream --dashboard-url http://admin@localhost/RPC2/ /anonymous/qemu/ lava-dashboard-tool make-stream --dashboard-url http://$adminuser@$lavaaddr/RPC2/ /anonymous/qemu/
Line 100: Line 112:
mkdir lava cd
lavadir=`pwd`/lava
mkdir lavadir
Line 104: Line 118:
wget http://releases.linaro.org/images/12.03/oneiric/nano/beagle-nano.img.gz -O 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
Line 124: Line 138:
' > lava/lava-test-shell-simple.yaml; ' > $lavadir/lava-test-shell-simple.yaml;
Line 126: Line 140:
# create job file: /home/userx/lava/qemu.json # create job file: ~/lava/qemu.json
Line 141: Line 155:
        "image": "file:///home/userx/lava/beagle-nano.img.gz"         "image": "file://$lavadir/beagle-nano.img.gz"
Line 149: Line 163:
            "file:///home/userx/lava/lava-test-shell-simple.yaml"             "file://$lavadir/lava-test-shell-simple.yaml"
Line 157: Line 171:
            "server": "http://localhost/RPC2/"             "server": "$lavaurl/RPC2/"
Line 162: Line 176:
' > lava/qemu.json; ' > $lavadir/qemu.json;
Line 165: Line 179:
lava-tool submit-job http://admin@localhost/RPC2/ lava/qemu.json lava-tool submit-job http://$adminuser@$lavaaddr/RPC2/ lava/qemu.json

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


# You may need to login # bzr launchpad-login <launchpad.net login id>


# 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 {user: admin, password: admin}

  • /lava-deployment-tool manage mylava createsuperuser


# install QEMU
 sudo apt-get install qemu-system

# Create device configuration file
 mkdir /srv/lava/instances/mylava/etc/lava-dispatcher/devices
 echo "device_type = qemu" > /srv/lava/instances/mylava/etc/lava-dispatcher/devices/qemu01.conf 

# install client tools
 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

# authenticate to the API
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


# create bundle stream
lava-dashboard-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/
# Add new device "qemu01" of device type "qemu"
## http://localhost/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

#######
# create test shell file: /home/userx/lava/lava-test-shell-simple.yaml
####################################################
############ lava-test-shell-simple.yaml ###########
####################################################
cd
echo '
metadata:
  name: lava-test-shell-simple
  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 ####################
####################################################
cd
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": "$lavaurl/RPC2/"
        }
    }
  ]
}
' > $lavadir/qemu.json;

# submit a job 
lava-tool submit-job http://$adminuser@$lavaaddr/RPC2/ lava/qemu.json

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