Browse code

move setup_quantum to stack.sh

sudo is only allowed in stack.sh on the CI, so move setup_quantum code
to the stack.sh.
also fixes quantum debug command setup for linuxbridge and ryu

Change-Id: I11bc0aa242a690e25acc088b3e9f483ceab38f26

Nachi Ueno authored on 2012/11/20 15:04:28
Showing 9 changed files
... ...
@@ -35,7 +35,6 @@ source $TOP_DIR/openrc
35 35
 # Import quantum functions if needed
36 36
 if is_service_enabled quantum; then
37 37
     source $TOP_DIR/lib/quantum
38
-    setup_quantum
39 38
 fi
40 39
 
41 40
 # Import exercise configuration
... ...
@@ -174,10 +173,6 @@ nova floating-ip-delete $FLOATING_IP || \
174 174
 # Delete a secgroup
175 175
 nova secgroup-delete $SECGROUP || die "Failure deleting security group $SECGROUP"
176 176
 
177
-if is_service_enabled quantum; then
178
-    teardown_quantum
179
-fi
180
-
181 177
 set +o xtrace
182 178
 echo "*********************************************************************"
183 179
 echo "SUCCESS: End DevStack Exercise: $0"
... ...
@@ -36,7 +36,6 @@ source $TOP_DIR/eucarc
36 36
 # Import quantum functions if needed
37 37
 if is_service_enabled quantum; then
38 38
     source $TOP_DIR/lib/quantum
39
-    setup_quantum
40 39
 fi
41 40
 
42 41
 # Import exercise configuration
... ...
@@ -175,10 +174,6 @@ fi
175 175
 # Delete group
176 176
 euca-delete-group $SECGROUP || die "Failure deleting security group $SECGROUP"
177 177
 
178
-if is_service_enabled quantum; then
179
-    teardown_quantum
180
-fi
181
-
182 178
 set +o xtrace
183 179
 echo "*********************************************************************"
184 180
 echo "SUCCESS: End DevStack Exercise: $0"
... ...
@@ -34,7 +34,6 @@ source $TOP_DIR/openrc
34 34
 # Import quantum functions if needed
35 35
 if is_service_enabled quantum; then
36 36
     source $TOP_DIR/lib/quantum
37
-    setup_quantum
38 37
 fi
39 38
 
40 39
 # Import exercise configuration
... ...
@@ -202,10 +201,6 @@ fi
202 202
 # Delete a secgroup
203 203
 nova secgroup-delete $SECGROUP || die "Failure deleting security group $SECGROUP"
204 204
 
205
-if is_service_enabled quantum; then
206
-    teardown_quantum
207
-fi
208
-
209 205
 set +o xtrace
210 206
 echo "*********************************************************************"
211 207
 echo "SUCCESS: End DevStack Exercise: $0"
... ...
@@ -58,7 +58,6 @@ is_service_enabled quantum && is_service_enabled q-agt && is_service_enabled q-d
58 58
 
59 59
 # Import quantum fucntions
60 60
 source $TOP_DIR/lib/quantum
61
-setup_quantum
62 61
 
63 62
 # Import exercise configuration
64 63
 source $TOP_DIR/exerciserc
... ...
@@ -475,7 +474,6 @@ main() {
475 475
 }
476 476
 
477 477
 
478
-teardown_quantum
479 478
 #-------------------------------------------------------------------------------
480 479
 # Kick off script.
481 480
 #-------------------------------------------------------------------------------
... ...
@@ -33,7 +33,6 @@ source $TOP_DIR/openrc
33 33
 # Import quantum functions if needed
34 34
 if is_service_enabled quantum; then
35 35
     source $TOP_DIR/lib/quantum
36
-    setup_quantum
37 36
 fi
38 37
 
39 38
 # Import exercise configuration
... ...
@@ -212,10 +211,6 @@ fi
212 212
 # Delete a secgroup
213 213
 nova secgroup-delete $SECGROUP || die "Failure deleting security group $SECGROUP"
214 214
 
215
-if is_service_enabled quantum; then
216
-    teardown_quantum
217
-fi
218
-
219 215
 set +o xtrace
220 216
 echo "*********************************************************************"
221 217
 echo "SUCCESS: End DevStack Exercise: $0"
... ...
@@ -5,9 +5,20 @@
5 5
 XTRACE=$(set +o | grep xtrace)
6 6
 set +o xtrace
7 7
 
8
+QUANTUM_DIR=$DEST/quantum
8 9
 export QUANTUM_TEST_CONFIG_FILE=${QUANTUM_TEST_CONFIG_FILE:-"/etc/quantum/debug.ini"}
9 10
 QUANTUM_AUTH_CACHE_DIR=${QUANTUM_AUTH_CACHE_DIR:-/var/cache/quantum}
10 11
 
12
+if is_service_enabled quantum; then
13
+    Q_CONF_FILE=/etc/quantum/quantum.conf
14
+    Q_RR_CONF_FILE=/etc/quantum/rootwrap.conf
15
+    if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then
16
+        Q_RR_COMMAND="sudo"
17
+    else
18
+        Q_RR_COMMAND="sudo $QUANTUM_DIR/bin/quantum-rootwrap $Q_RR_CONF_FILE"
19
+    fi
20
+fi
21
+
11 22
 # Configures keystone integration for quantum service and agents
12 23
 function quantum_setup_keystone() {
13 24
     local conf_file=$1
... ...
@@ -74,7 +85,7 @@ function _get_probe_cmd_prefix() {
74 74
     local from_net="$1"
75 75
     net_id=`_get_net_id $from_net`
76 76
     probe_id=`quantum-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-list -c id -c network_id | grep $net_id | awk '{print $2}' | head -n 1`
77
-    echo "sudo ip netns exec qprobe-$probe_id"
77
+    echo "$Q_RR_COMMAND ip netns exec qprobe-$probe_id"
78 78
 }
79 79
 
80 80
 function delete_probe() {
... ...
@@ -92,9 +103,9 @@ function _ping_check_quantum() {
92 92
     local check_command=""
93 93
     probe_cmd=`_get_probe_cmd_prefix $from_net`
94 94
     if [[ "$expected" = "True" ]]; then
95
-        check_command="while ! $probe_cmd ping -c1 -w1 $ip; do sleep 1; done"
95
+        check_command="while ! $probe_cmd ping -w 1 -c 1 $ip; do sleep 1; done"
96 96
     else
97
-        check_command="while $probe_cmd ping -c1 -w1 $ip; do sleep 1; done"
97
+        check_command="while $probe_cmd ping -w 1 -c 1 $ip; do sleep 1; done"
98 98
     fi
99 99
     if ! timeout $timeout_sec sh -c "$check_command"; then
100 100
         if [[ "$expected" = "True" ]]; then
... ...
@@ -72,6 +72,3 @@ export COMPUTE_API_VERSION=${COMPUTE_API_VERSION:-$NOVA_VERSION}
72 72
 # set log level to DEBUG (helps debug issues)
73 73
 # export KEYSTONECLIENT_DEBUG=1
74 74
 # export NOVACLIENT_DEBUG=1
75
-
76
-# set quantum debug command
77
-export QUANTUM_TEST_CONFIG_FILE=${QUANTUM_TEST_CONFIG_FILE:-"/etc/quantum/debug.ini"}
... ...
@@ -321,7 +321,6 @@ HORIZON_DIR=$DEST/horizon
321 321
 OPENSTACKCLIENT_DIR=$DEST/python-openstackclient
322 322
 NOVNC_DIR=$DEST/noVNC
323 323
 SWIFT3_DIR=$DEST/swift3
324
-QUANTUM_DIR=$DEST/quantum
325 324
 QUANTUM_CLIENT_DIR=$DEST/python-quantumclient
326 325
 
327 326
 # Default Quantum Plugin
... ...
@@ -1153,14 +1152,7 @@ if is_service_enabled quantum; then
1153 1153
     iniset /$Q_PLUGIN_CONF_FILE DATABASE sql_connection $dburl
1154 1154
     unset dburl
1155 1155
 
1156
-    Q_CONF_FILE=/etc/quantum/quantum.conf
1157 1156
     cp $QUANTUM_DIR/etc/quantum.conf $Q_CONF_FILE
1158
-    Q_RR_CONF_FILE=/etc/quantum/rootwrap.conf
1159
-    if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then
1160
-        Q_RR_COMMAND="sudo"
1161
-    else
1162
-        Q_RR_COMMAND="sudo $QUANTUM_DIR/bin/quantum-rootwrap $Q_RR_CONF_FILE"
1163
-    fi
1164 1157
     cp -p $QUANTUM_DIR/etc/rootwrap.conf $Q_RR_CONF_FILE
1165 1158
 
1166 1159
     # Copy over the config and filter bits
... ...
@@ -1400,13 +1392,22 @@ if is_service_enabled quantum; then
1400 1400
         iniset $Q_CONF_FILE DEFAULT rabbit_password $RABBIT_PASSWORD
1401 1401
     fi
1402 1402
     if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then
1403
-        Q_DEBUG_CONF_FILE=/etc/quantum/debug.ini
1404
-        cp $QUANTUM_DIR/etc/l3_agent.ini $Q_DEBUG_CONF_FILE
1405
-        iniset $Q_L3_CONF_FILE DEFAULT verbose False
1406
-        iniset $Q_L3_CONF_FILE DEFAULT debug False
1407
-        iniset $Q_L3_CONF_FILE DEFAULT metadata_ip $Q_META_DATA_IP
1408
-        iniset $Q_L3_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
1409
-        iniset $Q_L3_CONF_FILE DEFAULT root_helper "sudo"
1403
+        cp $QUANTUM_DIR/etc/l3_agent.ini $QUANTUM_TEST_CONFIG_FILE
1404
+        iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT verbose False
1405
+        iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT debug False
1406
+        iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
1407
+        quantum_setup_keystone $QUANTUM_TEST_CONFIG_FILE DEFAULT set_auth_url
1408
+        if [[ "$Q_PLUGIN" == "openvswitch" ]]; then
1409
+            iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver
1410
+            iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE
1411
+        elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
1412
+            iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT interface_driver quantum.agent.linux.interface.BridgeInterfaceDriver
1413
+            iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge ''
1414
+        elif [[ "$Q_PLUGIN" = "ryu" ]]; then
1415
+            iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT interface_driver quantum.agent.linux.interface.RyuInterfaceDriver
1416
+            iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE
1417
+            iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT
1418
+        fi
1410 1419
     fi
1411 1420
 fi
1412 1421
 
... ...
@@ -1633,7 +1634,9 @@ if is_service_enabled q-svc; then
1633 1633
             iniset $Q_L3_CONF_FILE DEFAULT router_id $ROUTER_ID
1634 1634
         fi
1635 1635
    fi
1636
-
1636
+   if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then
1637
+      setup_quantum
1638
+   fi
1637 1639
 elif is_service_enabled $DATABASE_BACKENDS && is_service_enabled n-net; then
1638 1640
     # Create a small network
1639 1641
     $NOVA_BIN_DIR/nova-manage network create "$PRIVATE_NETWORK_NAME" $FIXED_RANGE 1 $FIXED_NETWORK_SIZE $NETWORK_CREATE_ARGS
... ...
@@ -37,6 +37,12 @@ if [[ "$1" == "--all" ]]; then
37 37
     UNSTACK_ALL=${UNSTACK_ALL:-1}
38 38
 fi
39 39
 
40
+if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then
41
+    source $TOP_DIR/openrc
42
+    source $TOP_DIR/lib/quantum
43
+    teardown_quantum
44
+fi
45
+
40 46
 # Shut down devstack's screen to get the bulk of OpenStack services in one shot
41 47
 SCREEN=$(which screen)
42 48
 if [[ -n "$SCREEN" ]]; then