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
diff --git a/exercises/boot_from_volume.sh b/exercises/boot_from_volume.sh
index 4c2f279..5ebdecc 100755
--- a/exercises/boot_from_volume.sh
+++ b/exercises/boot_from_volume.sh
@@ -35,7 +35,6 @@
# Import quantum functions if needed
if is_service_enabled quantum; then
source $TOP_DIR/lib/quantum
- setup_quantum
fi
# Import exercise configuration
@@ -174,10 +173,6 @@
# Delete a secgroup
nova secgroup-delete $SECGROUP || die "Failure deleting security group $SECGROUP"
-if is_service_enabled quantum; then
- teardown_quantum
-fi
-
set +o xtrace
echo "*********************************************************************"
echo "SUCCESS: End DevStack Exercise: $0"
diff --git a/exercises/euca.sh b/exercises/euca.sh
index c307a06..67da1be 100755
--- a/exercises/euca.sh
+++ b/exercises/euca.sh
@@ -36,7 +36,6 @@
# Import quantum functions if needed
if is_service_enabled quantum; then
source $TOP_DIR/lib/quantum
- setup_quantum
fi
# Import exercise configuration
@@ -175,10 +174,6 @@
# Delete group
euca-delete-group $SECGROUP || die "Failure deleting security group $SECGROUP"
-if is_service_enabled quantum; then
- teardown_quantum
-fi
-
set +o xtrace
echo "*********************************************************************"
echo "SUCCESS: End DevStack Exercise: $0"
diff --git a/exercises/floating_ips.sh b/exercises/floating_ips.sh
index ae5691f..8b18e6f 100755
--- a/exercises/floating_ips.sh
+++ b/exercises/floating_ips.sh
@@ -34,7 +34,6 @@
# Import quantum functions if needed
if is_service_enabled quantum; then
source $TOP_DIR/lib/quantum
- setup_quantum
fi
# Import exercise configuration
@@ -202,10 +201,6 @@
# Delete a secgroup
nova secgroup-delete $SECGROUP || die "Failure deleting security group $SECGROUP"
-if is_service_enabled quantum; then
- teardown_quantum
-fi
-
set +o xtrace
echo "*********************************************************************"
echo "SUCCESS: End DevStack Exercise: $0"
diff --git a/exercises/quantum-adv-test.sh b/exercises/quantum-adv-test.sh
index 2ee82ff..493e223 100755
--- a/exercises/quantum-adv-test.sh
+++ b/exercises/quantum-adv-test.sh
@@ -58,7 +58,6 @@
# Import quantum fucntions
source $TOP_DIR/lib/quantum
-setup_quantum
# Import exercise configuration
source $TOP_DIR/exerciserc
@@ -475,7 +474,6 @@
}
-teardown_quantum
#-------------------------------------------------------------------------------
# Kick off script.
#-------------------------------------------------------------------------------
diff --git a/exercises/volumes.sh b/exercises/volumes.sh
index 3432763..42f9cb4 100755
--- a/exercises/volumes.sh
+++ b/exercises/volumes.sh
@@ -33,7 +33,6 @@
# Import quantum functions if needed
if is_service_enabled quantum; then
source $TOP_DIR/lib/quantum
- setup_quantum
fi
# Import exercise configuration
@@ -212,10 +211,6 @@
# Delete a secgroup
nova secgroup-delete $SECGROUP || die "Failure deleting security group $SECGROUP"
-if is_service_enabled quantum; then
- teardown_quantum
-fi
-
set +o xtrace
echo "*********************************************************************"
echo "SUCCESS: End DevStack Exercise: $0"
diff --git a/lib/quantum b/lib/quantum
index 373d521..14a3a4a 100644
--- a/lib/quantum
+++ b/lib/quantum
@@ -5,9 +5,20 @@
XTRACE=$(set +o | grep xtrace)
set +o xtrace
+QUANTUM_DIR=$DEST/quantum
export QUANTUM_TEST_CONFIG_FILE=${QUANTUM_TEST_CONFIG_FILE:-"/etc/quantum/debug.ini"}
QUANTUM_AUTH_CACHE_DIR=${QUANTUM_AUTH_CACHE_DIR:-/var/cache/quantum}
+if is_service_enabled quantum; then
+ Q_CONF_FILE=/etc/quantum/quantum.conf
+ Q_RR_CONF_FILE=/etc/quantum/rootwrap.conf
+ if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then
+ Q_RR_COMMAND="sudo"
+ else
+ Q_RR_COMMAND="sudo $QUANTUM_DIR/bin/quantum-rootwrap $Q_RR_CONF_FILE"
+ fi
+fi
+
# Configures keystone integration for quantum service and agents
function quantum_setup_keystone() {
local conf_file=$1
@@ -74,7 +85,7 @@
local from_net="$1"
net_id=`_get_net_id $from_net`
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`
- echo "sudo ip netns exec qprobe-$probe_id"
+ echo "$Q_RR_COMMAND ip netns exec qprobe-$probe_id"
}
function delete_probe() {
@@ -92,9 +103,9 @@
local check_command=""
probe_cmd=`_get_probe_cmd_prefix $from_net`
if [[ "$expected" = "True" ]]; then
- check_command="while ! $probe_cmd ping -c1 -w1 $ip; do sleep 1; done"
+ check_command="while ! $probe_cmd ping -w 1 -c 1 $ip; do sleep 1; done"
else
- check_command="while $probe_cmd ping -c1 -w1 $ip; do sleep 1; done"
+ check_command="while $probe_cmd ping -w 1 -c 1 $ip; do sleep 1; done"
fi
if ! timeout $timeout_sec sh -c "$check_command"; then
if [[ "$expected" = "True" ]]; then
diff --git a/openrc b/openrc
index 4b6b9b2..08ef98b 100644
--- a/openrc
+++ b/openrc
@@ -72,6 +72,3 @@
# set log level to DEBUG (helps debug issues)
# export KEYSTONECLIENT_DEBUG=1
# export NOVACLIENT_DEBUG=1
-
-# set quantum debug command
-export QUANTUM_TEST_CONFIG_FILE=${QUANTUM_TEST_CONFIG_FILE:-"/etc/quantum/debug.ini"}
diff --git a/stack.sh b/stack.sh
index 55eafa8..1d1ad63 100755
--- a/stack.sh
+++ b/stack.sh
@@ -321,7 +321,6 @@
OPENSTACKCLIENT_DIR=$DEST/python-openstackclient
NOVNC_DIR=$DEST/noVNC
SWIFT3_DIR=$DEST/swift3
-QUANTUM_DIR=$DEST/quantum
QUANTUM_CLIENT_DIR=$DEST/python-quantumclient
# Default Quantum Plugin
@@ -1153,14 +1152,7 @@
iniset /$Q_PLUGIN_CONF_FILE DATABASE sql_connection $dburl
unset dburl
- Q_CONF_FILE=/etc/quantum/quantum.conf
cp $QUANTUM_DIR/etc/quantum.conf $Q_CONF_FILE
- Q_RR_CONF_FILE=/etc/quantum/rootwrap.conf
- if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then
- Q_RR_COMMAND="sudo"
- else
- Q_RR_COMMAND="sudo $QUANTUM_DIR/bin/quantum-rootwrap $Q_RR_CONF_FILE"
- fi
cp -p $QUANTUM_DIR/etc/rootwrap.conf $Q_RR_CONF_FILE
# Copy over the config and filter bits
@@ -1400,13 +1392,22 @@
iniset $Q_CONF_FILE DEFAULT rabbit_password $RABBIT_PASSWORD
fi
if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then
- Q_DEBUG_CONF_FILE=/etc/quantum/debug.ini
- cp $QUANTUM_DIR/etc/l3_agent.ini $Q_DEBUG_CONF_FILE
- iniset $Q_L3_CONF_FILE DEFAULT verbose False
- iniset $Q_L3_CONF_FILE DEFAULT debug False
- iniset $Q_L3_CONF_FILE DEFAULT metadata_ip $Q_META_DATA_IP
- iniset $Q_L3_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
- iniset $Q_L3_CONF_FILE DEFAULT root_helper "sudo"
+ cp $QUANTUM_DIR/etc/l3_agent.ini $QUANTUM_TEST_CONFIG_FILE
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT verbose False
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT debug False
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
+ quantum_setup_keystone $QUANTUM_TEST_CONFIG_FILE DEFAULT set_auth_url
+ if [[ "$Q_PLUGIN" == "openvswitch" ]]; then
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE
+ elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT interface_driver quantum.agent.linux.interface.BridgeInterfaceDriver
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge ''
+ elif [[ "$Q_PLUGIN" = "ryu" ]]; then
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT interface_driver quantum.agent.linux.interface.RyuInterfaceDriver
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT
+ fi
fi
fi
@@ -1633,7 +1634,9 @@
iniset $Q_L3_CONF_FILE DEFAULT router_id $ROUTER_ID
fi
fi
-
+ if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then
+ setup_quantum
+ fi
elif is_service_enabled $DATABASE_BACKENDS && is_service_enabled n-net; then
# Create a small network
$NOVA_BIN_DIR/nova-manage network create "$PRIVATE_NETWORK_NAME" $FIXED_RANGE 1 $FIXED_NETWORK_SIZE $NETWORK_CREATE_ARGS
diff --git a/unstack.sh b/unstack.sh
index 20ba17b..a01ed6d 100755
--- a/unstack.sh
+++ b/unstack.sh
@@ -37,6 +37,12 @@
UNSTACK_ALL=${UNSTACK_ALL:-1}
fi
+if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then
+ source $TOP_DIR/openrc
+ source $TOP_DIR/lib/quantum
+ teardown_quantum
+fi
+
# Shut down devstack's screen to get the bulk of OpenStack services in one shot
SCREEN=$(which screen)
if [[ -n "$SCREEN" ]]; then