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
This commit is contained in:
Nachi Ueno 2012-11-19 22:04:28 -08:00
parent a1daabd340
commit 8bc21f6476
9 changed files with 39 additions and 44 deletions

View File

@ -35,7 +35,6 @@ source $TOP_DIR/openrc
# 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 @@ nova floating-ip-delete $FLOATING_IP || \
# 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"

View File

@ -36,7 +36,6 @@ source $TOP_DIR/eucarc
# 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 @@ fi
# 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"

View File

@ -34,7 +34,6 @@ source $TOP_DIR/openrc
# 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 @@ fi
# 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"

View File

@ -58,7 +58,6 @@ is_service_enabled quantum && is_service_enabled q-agt && is_service_enabled q-d
# Import quantum fucntions
source $TOP_DIR/lib/quantum
setup_quantum
# Import exercise configuration
source $TOP_DIR/exerciserc
@ -475,7 +474,6 @@ main() {
}
teardown_quantum
#-------------------------------------------------------------------------------
# Kick off script.
#-------------------------------------------------------------------------------

View File

@ -33,7 +33,6 @@ source $TOP_DIR/openrc
# 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 @@ fi
# 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"

View File

@ -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 @@ function _get_probe_cmd_prefix() {
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 @@ function _ping_check_quantum() {
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

3
openrc
View File

@ -72,6 +72,3 @@ export COMPUTE_API_VERSION=${COMPUTE_API_VERSION:-$NOVA_VERSION}
# 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"}

View File

@ -321,7 +321,6 @@ HORIZON_DIR=$DEST/horizon
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 @@ if is_service_enabled quantum; then
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 @@ if is_service_enabled quantum; then
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 @@ if is_service_enabled q-svc; then
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

View File

@ -37,6 +37,12 @@ if [[ "$1" == "--all" ]]; then
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