diff --git a/exercises/boot_from_volume.sh b/exercises/boot_from_volume.sh index 4c2f279e04..5ebdecc755 100755 --- a/exercises/boot_from_volume.sh +++ b/exercises/boot_from_volume.sh @@ -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" diff --git a/exercises/euca.sh b/exercises/euca.sh index c307a06405..67da1beeaf 100755 --- a/exercises/euca.sh +++ b/exercises/euca.sh @@ -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" diff --git a/exercises/floating_ips.sh b/exercises/floating_ips.sh index ae5691f47a..8b18e6f4ba 100755 --- a/exercises/floating_ips.sh +++ b/exercises/floating_ips.sh @@ -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" diff --git a/exercises/quantum-adv-test.sh b/exercises/quantum-adv-test.sh index 2ee82ff216..493e22393c 100755 --- a/exercises/quantum-adv-test.sh +++ b/exercises/quantum-adv-test.sh @@ -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. #------------------------------------------------------------------------------- diff --git a/exercises/volumes.sh b/exercises/volumes.sh index 3432763fe7..42f9cb4e72 100755 --- a/exercises/volumes.sh +++ b/exercises/volumes.sh @@ -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" diff --git a/lib/quantum b/lib/quantum index 373d5217f6..14a3a4ad5e 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 @@ 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 diff --git a/openrc b/openrc index 4b6b9b2bf4..08ef98be78 100644 --- a/openrc +++ b/openrc @@ -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"} diff --git a/stack.sh b/stack.sh index 55eafa824c..1d1ad636da 100755 --- a/stack.sh +++ b/stack.sh @@ -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 diff --git a/unstack.sh b/unstack.sh index 20ba17b66b..a01ed6d112 100755 --- a/unstack.sh +++ b/unstack.sh @@ -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