Merge lp:~le-chi-thu/lava-deployment-tool/add-dispatch-config into lp:~linaro-validation/lava-deployment-tool/trunk

Proposed by Le Chi Thu
Status: Merged
Approved by: Zygmunt Krynicki
Approved revision: 171
Merged at revision: 166
Proposed branch: lp:~le-chi-thu/lava-deployment-tool/add-dispatch-config
Merge into: lp:~linaro-validation/lava-deployment-tool/trunk
Diff against target: 155 lines (+108/-1)
1 file modified
lava-deployment-tool (+108/-1)
To merge this branch: bzr merge lp:~le-chi-thu/lava-deployment-tool/add-dispatch-config
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve
Review via email: mp+103302@code.launchpad.net

Description of the change

Add configuration wizard for lava-dispatcher. Only two parameters (LAVA_SERVER_IP and LAVA_PROXY) are need user input. Other parameters are calculated. Also the apache conf is correctly setup for dispatcher.

To post a comment you must log in.
168. By Le Chi Thu <email address hidden> <email address hidden>

Minor update after the review 1

169. By Le Chi Thu <email address hidden> <email address hidden>

Fixed typo error

170. By Le Chi Thu <email address hidden> <email address hidden>

Minor update after the review 2

171. By Le Chi Thu <email address hidden> <email address hidden>

Minor update after the review 2

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

+1

Approving after discussion and review on IRC

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava-deployment-tool'
2--- lava-deployment-tool 2012-04-06 00:20:45 +0000
3+++ lava-deployment-tool 2012-04-25 08:05:21 +0000
4@@ -1,5 +1,5 @@
5 #!/bin/bash
6-LAVA_DEPLOYMENT_TOOL_VERSION="0.3"
7+LAVA_DEPLOYMENT_TOOL_VERSION="0.4"
8
9 # Global Configuration
10
11@@ -104,6 +104,8 @@
12 LAVA_RABBIT_PASSWORD='$LAVA_RABBIT_PASSWORD'
13 # Scheduler configuration
14 LAVA_SCHEDULER_ENABLED='$LAVA_SCHEDULER_ENABLED'
15+LAVA_SERVER_IP='$LAVA_SERVER_IP'
16+LAVA_PROXY='$LAVA_PROXY'
17 INSTANCE_CONF
18 }
19
20@@ -303,6 +305,9 @@
21 mkdir -p $LAVA_PREFIX/$LAVA_INSTANCE/etc/lava-server/templates
22 # Static file cache
23 mkdir -p $LAVA_PREFIX/$LAVA_INSTANCE/var/www/lava-server/static
24+ # Lava-dispatcher folders
25+ mkdir -p $LAVA_PREFIX/$LAVA_INSTANCE/var/cache/lava-dispatcher
26+ mkdir -p $LAVA_PREFIX/$LAVA_INSTANCE/var/www/lava-server/images
27 # Repository of precious user-generated data (needs backup)
28 mkdir -p $LAVA_PREFIX/$LAVA_INSTANCE/var/lib/lava-server/media
29 # Celery state
30@@ -716,6 +721,12 @@
31 SetHandler none
32 </Location>
33 # We don't need media files as those are private in our implementation
34+
35+ # images folder for lava-dispatcher tarballs
36+ <Location /images>
37+ SetHandler none
38+ </Location>
39+
40
41 </VirtualHost>
42 INSTANCE_SITE
43@@ -780,6 +791,8 @@
44 set +x
45 deactivate
46
47+ gen_lava_dispatcher_config
48+
49 if [ ! -e $LAVA_PREFIX/$LAVA_INSTANCE/etc/lava-server/settings.conf ]; then
50 if [ -e $LAVA_PREFIX/$LAVA_INSTANCE/src/lava-server ]; then
51 # We're in editable server mode, let's use alternate paths for tempates and static files
52@@ -864,9 +877,103 @@
53 wizard_config_app() {
54 local _question="Do you want to enable the scheduler in this instance?"
55 whiptail --title "Enable the scheduler?" --yesno "$_question" 10 40 && LAVA_SCHEDULER_ENABLED=yes || LAVA_SCHEDULER_ENABLED=no
56+
57+ local _question="Do you want to config the lava-dispatcher?"
58+ whiptail --title "Configurate the lava-dispatcher?" --yesno "$_question" 10 40 && LAVA_DISPATCHER_CONFIG=yes || LAVA_DISPATCHER_CONFIG=no
59+
60+ if [ $LAVA_DISPATCHER_CONFIG = yes ]; then
61+ config_lava_dispatcher
62+ fi
63+
64 return 0
65 }
66
67+config_lava_dispatcher() {
68+ echo "Lava Dispatcher Configuration"
69+ echo "-----------------------------"
70+
71+ echo "LAVA_SERVER_IP"
72+ echo "^^^^^^^^^^^^^^"
73+ echo "This is the IP the device downloads the image parts from"
74+ echo ""
75+ echo "Here is the list of network device on this host"
76+
77+ ifconfig | grep 'Ethernet\|inet addr'
78+
79+ while true; do
80+
81+ read -p "Please enter the IP address: " LAVA_SERVER_IP
82+
83+ if test -n "$LAVA_SERVER_IP" && echo "$LAVA_SERVER_IP" | grep -q -E -e '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'; then
84+ echo "The IP address is '$LAVA_SERVER_IP'"
85+ break
86+ else
87+ echo "Incorrect IP address"
88+ fi
89+ done
90+
91+ echo
92+ echo "LAVA_PROXY"
93+ echo "^^^^^^^^^^"
94+
95+ echo "This is the address and port of cache proxy service, format is like:"
96+ echo "http://192.168.1.10:3128/"
97+ read -p "Please enter the URL: " LAVA_PROXY
98+
99+
100+ # Location for rootfs/boot tarballs extracted from images
101+ export LAVA_IMAGE_TMPDIR=$LAVA_PREFIX/$LAVA_INSTANCE/var/www/lava-server/images
102+
103+ # URL where LAVA_IMAGE_TMPDIR can be accessed remotely
104+ export LAVA_IMAGE_URL=http://$SERVER_IP/lava-server/images
105+
106+ # Location on the device for storing test results.
107+ export LAVA_RESULT_DIR=$LAVA_PREFIX/$LAVA_INSTANCE/tmp
108+
109+ # Location for caching downloaded artifacts such as hwpacks and images
110+ export LAVA_CACHEDIR=$LAVA_PREFIX/$LAVA_INSTANCE/var/cache/lava-dispatcher
111+
112+}
113+
114+gen_lava_dispatcher_config() {
115+ LAVA_DISPATCHER_CONFIG_FILE=$LAVA_PREFIX/$LAVA_INSTANCE/etc/lava-dispatcher/lava-dispatcher.conf
116+
117+ echo "Creating lava-dispatcher config file $LAVA_DISPATCHER_CONFIG_FILE"
118+ sudo sh -c "cat >$LAVA_DISPATCHER_CONFIG_FILE" <<LAVA_DISPATCHER_CONF
119+# This file was automatically generated by lava-deployment-tool.sh
120+
121+LAVA_SERVER_IP = $LAVA_SERVER_IP
122+
123+# Location for rootfs/boot tarballs extracted from images
124+LAVA_IMAGE_TMPDIR = $LAVA_IMAGE_TMPDIR
125+
126+# URL where LAVA_IMAGE_TMPDIR can be accessed remotely
127+LAVA_IMAGE_URL = http://%(LAVA_SERVER_IP)s/images
128+
129+# Location on the device for storing test results.
130+LAVA_RESULT_DIR = $LAVA_RESULT_DIR
131+
132+# Location for caching downloaded artifacts such as hwpacks and images
133+LAVA_CACHEDIR = $LAVA_CACHEDIR
134+
135+# This is the address and port of cache proxy service, format is like:
136+# LAVA_PROXY = http://192.168.1.10:3128/
137+LAVA_PROXY = $LAVA_PROXY
138+
139+# The url point to the version of lava-test to be install with pip
140+#LAVA_TEST_URL = bzr+http://bazaar.launchpad.net/~le-chi-thu/lava-test/enabled-file-cache/#egg=lava-test
141+
142+# Python logging level to use
143+# # 10 = DEBUG
144+# # 20 = INFO
145+# # 30 = WARNING
146+# # 40 = ERROR
147+# # Messages with a lower number than LOGGING_LEVEL will be suppressed
148+# LOGGING_LEVEL = 10
149+
150+LAVA_DISPATCHER_CONF
151+
152+}
153
154 install_config_app() {
155 # Enable virtualenv

Subscribers

People subscribed via source and target branches