Merge "Make exercise.sh with quantum work"
This commit is contained in:
commit
b459d0e3ba
@ -32,6 +32,12 @@ source $TOP_DIR/functions
|
|||||||
# Import configuration
|
# Import configuration
|
||||||
source $TOP_DIR/openrc
|
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
|
# Import exercise configuration
|
||||||
source $TOP_DIR/exerciserc
|
source $TOP_DIR/exerciserc
|
||||||
|
|
||||||
@ -168,6 +174,10 @@ nova floating-ip-delete $FLOATING_IP || \
|
|||||||
# Delete a secgroup
|
# Delete a secgroup
|
||||||
nova secgroup-delete $SECGROUP || die "Failure deleting security group $SECGROUP"
|
nova secgroup-delete $SECGROUP || die "Failure deleting security group $SECGROUP"
|
||||||
|
|
||||||
|
if is_service_enabled quantum; then
|
||||||
|
teardown_quantum
|
||||||
|
fi
|
||||||
|
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
echo "*********************************************************************"
|
echo "*********************************************************************"
|
||||||
echo "SUCCESS: End DevStack Exercise: $0"
|
echo "SUCCESS: End DevStack Exercise: $0"
|
||||||
|
@ -33,6 +33,12 @@ source $TOP_DIR/functions
|
|||||||
# Import EC2 configuration
|
# Import EC2 configuration
|
||||||
source $TOP_DIR/eucarc
|
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
|
# Import exercise configuration
|
||||||
source $TOP_DIR/exerciserc
|
source $TOP_DIR/exerciserc
|
||||||
|
|
||||||
@ -169,6 +175,10 @@ fi
|
|||||||
# Delete group
|
# Delete group
|
||||||
euca-delete-group $SECGROUP || die "Failure deleting security group $SECGROUP"
|
euca-delete-group $SECGROUP || die "Failure deleting security group $SECGROUP"
|
||||||
|
|
||||||
|
if is_service_enabled quantum; then
|
||||||
|
teardown_quantum
|
||||||
|
fi
|
||||||
|
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
echo "*********************************************************************"
|
echo "*********************************************************************"
|
||||||
echo "SUCCESS: End DevStack Exercise: $0"
|
echo "SUCCESS: End DevStack Exercise: $0"
|
||||||
|
@ -31,6 +31,12 @@ source $TOP_DIR/functions
|
|||||||
# Import configuration
|
# Import configuration
|
||||||
source $TOP_DIR/openrc
|
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
|
# Import exercise configuration
|
||||||
source $TOP_DIR/exerciserc
|
source $TOP_DIR/exerciserc
|
||||||
|
|
||||||
@ -155,14 +161,16 @@ nova add-floating-ip $VM_UUID $FLOATING_IP || \
|
|||||||
# test we can ping our floating ip within ASSOCIATE_TIMEOUT seconds
|
# test we can ping our floating ip within ASSOCIATE_TIMEOUT seconds
|
||||||
ping_check "$PUBLIC_NETWORK_NAME" $FLOATING_IP $ASSOCIATE_TIMEOUT
|
ping_check "$PUBLIC_NETWORK_NAME" $FLOATING_IP $ASSOCIATE_TIMEOUT
|
||||||
|
|
||||||
# Allocate an IP from second floating pool
|
if ! is_service_enabled quantum; then
|
||||||
TEST_FLOATING_IP=`nova floating-ip-create $TEST_FLOATING_POOL | grep $TEST_FLOATING_POOL | get_field 1`
|
# Allocate an IP from second floating pool
|
||||||
die_if_not_set TEST_FLOATING_IP "Failure creating floating IP in $TEST_FLOATING_POOL"
|
TEST_FLOATING_IP=`nova floating-ip-create $TEST_FLOATING_POOL | grep $TEST_FLOATING_POOL | get_field 1`
|
||||||
|
die_if_not_set TEST_FLOATING_IP "Failure creating floating IP in $TEST_FLOATING_POOL"
|
||||||
|
|
||||||
# list floating addresses
|
# list floating addresses
|
||||||
if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova floating-ip-list | grep $TEST_FLOATING_POOL | grep -q $TEST_FLOATING_IP; do sleep 1; done"; then
|
if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova floating-ip-list | grep $TEST_FLOATING_POOL | grep -q $TEST_FLOATING_IP; do sleep 1; done"; then
|
||||||
echo "Floating IP not allocated"
|
echo "Floating IP not allocated"
|
||||||
exit 1
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# dis-allow icmp traffic (ping)
|
# dis-allow icmp traffic (ping)
|
||||||
@ -171,12 +179,13 @@ nova secgroup-delete-rule $SECGROUP icmp -1 -1 0.0.0.0/0 || die "Failure deletin
|
|||||||
# FIXME (anthony): make xs support security groups
|
# FIXME (anthony): make xs support security groups
|
||||||
if [ "$VIRT_DRIVER" != "xenserver" -a "$VIRT_DRIVER" != "openvz" ]; then
|
if [ "$VIRT_DRIVER" != "xenserver" -a "$VIRT_DRIVER" != "openvz" ]; then
|
||||||
# test we can aren't able to ping our floating ip within ASSOCIATE_TIMEOUT seconds
|
# test we can aren't able to ping our floating ip within ASSOCIATE_TIMEOUT seconds
|
||||||
ping_check "$PUBLIC_NETWORK_NAME" $FLOATING_IP $ASSOCIATE_TIMEOUT
|
ping_check "$PUBLIC_NETWORK_NAME" $FLOATING_IP $ASSOCIATE_TIMEOUT Fail
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Delete second floating IP
|
if ! is_service_enabled quantum; then
|
||||||
nova floating-ip-delete $TEST_FLOATING_IP || die "Failure deleting floating IP $TEST_FLOATING_IP"
|
# Delete second floating IP
|
||||||
|
nova floating-ip-delete $TEST_FLOATING_IP || die "Failure deleting floating IP $TEST_FLOATING_IP"
|
||||||
|
fi
|
||||||
|
|
||||||
# de-allocate the floating ip
|
# de-allocate the floating ip
|
||||||
nova floating-ip-delete $FLOATING_IP || die "Failure deleting floating IP $FLOATING_IP"
|
nova floating-ip-delete $FLOATING_IP || die "Failure deleting floating IP $FLOATING_IP"
|
||||||
@ -193,6 +202,10 @@ fi
|
|||||||
# Delete a secgroup
|
# Delete a secgroup
|
||||||
nova secgroup-delete $SECGROUP || die "Failure deleting security group $SECGROUP"
|
nova secgroup-delete $SECGROUP || die "Failure deleting security group $SECGROUP"
|
||||||
|
|
||||||
|
if is_service_enabled quantum; then
|
||||||
|
teardown_quantum
|
||||||
|
fi
|
||||||
|
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
echo "*********************************************************************"
|
echo "*********************************************************************"
|
||||||
echo "SUCCESS: End DevStack Exercise: $0"
|
echo "SUCCESS: End DevStack Exercise: $0"
|
||||||
|
@ -52,13 +52,17 @@ source $TOP_DIR/functions
|
|||||||
# Import configuration
|
# Import configuration
|
||||||
source $TOP_DIR/openrc
|
source $TOP_DIR/openrc
|
||||||
|
|
||||||
# Import exercise configuration
|
|
||||||
source $TOP_DIR/exerciserc
|
|
||||||
|
|
||||||
# If quantum is not enabled we exit with exitcode 55 which mean
|
# If quantum is not enabled we exit with exitcode 55 which mean
|
||||||
# exercise is skipped.
|
# exercise is skipped.
|
||||||
is_service_enabled quantum && is_service_enabled q-agt && is_service_enabled q-dhcp || exit 55
|
is_service_enabled quantum && is_service_enabled q-agt && is_service_enabled q-dhcp || exit 55
|
||||||
|
|
||||||
|
# Import quantum fucntions
|
||||||
|
source $TOP_DIR/lib/quantum
|
||||||
|
setup_quantum
|
||||||
|
|
||||||
|
# Import exercise configuration
|
||||||
|
source $TOP_DIR/exerciserc
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Test settings for quantum
|
# Test settings for quantum
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
@ -76,14 +80,14 @@ DEMO1_NUM_NET=1
|
|||||||
DEMO2_NUM_NET=2
|
DEMO2_NUM_NET=2
|
||||||
|
|
||||||
PUBLIC_NET1_CIDR="200.0.0.0/24"
|
PUBLIC_NET1_CIDR="200.0.0.0/24"
|
||||||
DEMO1_NET1_CIDR="10.1.0.0/24"
|
DEMO1_NET1_CIDR="10.10.0.0/24"
|
||||||
DEMO2_NET1_CIDR="10.2.0.0/24"
|
DEMO2_NET1_CIDR="10.20.0.0/24"
|
||||||
DEMO2_NET2_CIDR="10.2.1.0/24"
|
DEMO2_NET2_CIDR="10.20.1.0/24"
|
||||||
|
|
||||||
PUBLIC_NET1_GATEWAY="200.0.0.1"
|
PUBLIC_NET1_GATEWAY="200.0.0.1"
|
||||||
DEMO1_NET1_GATEWAY="10.1.0.1"
|
DEMO1_NET1_GATEWAY="10.10.0.1"
|
||||||
DEMO2_NET1_GATEWAY="10.2.0.1"
|
DEMO2_NET1_GATEWAY="10.20.0.1"
|
||||||
DEMO2_NET2_GATEWAY="10.2.1.1"
|
DEMO2_NET2_GATEWAY="10.20.1.1"
|
||||||
|
|
||||||
PUBLIC_NUM_VM=1
|
PUBLIC_NUM_VM=1
|
||||||
DEMO1_NUM_VM=1
|
DEMO1_NUM_VM=1
|
||||||
@ -188,7 +192,7 @@ function get_flavor_id {
|
|||||||
|
|
||||||
function confirm_server_active {
|
function confirm_server_active {
|
||||||
local VM_UUID=$1
|
local VM_UUID=$1
|
||||||
if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova --no_cache show $VM_UUID | grep status | grep -q ACTIVE; do sleep 1; done"; then
|
if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova show $VM_UUID | grep status | grep -q ACTIVE; do sleep 1; done"; then
|
||||||
echo "server '$VM_UUID' did not become active!"
|
echo "server '$VM_UUID' did not become active!"
|
||||||
false
|
false
|
||||||
fi
|
fi
|
||||||
@ -232,6 +236,7 @@ function create_tenants {
|
|||||||
source $TOP_DIR/openrc admin admin
|
source $TOP_DIR/openrc admin admin
|
||||||
add_tenant demo1 demo1 demo1
|
add_tenant demo1 demo1 demo1
|
||||||
add_tenant demo2 demo2 demo2
|
add_tenant demo2 demo2 demo2
|
||||||
|
source $TOP_DIR/openrc demo demo
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete_tenants_and_users {
|
function delete_tenants_and_users {
|
||||||
@ -241,6 +246,7 @@ function delete_tenants_and_users {
|
|||||||
remove_user demo2
|
remove_user demo2
|
||||||
remove_tenant demo2
|
remove_tenant demo2
|
||||||
echo "removed all tenants"
|
echo "removed all tenants"
|
||||||
|
source $TOP_DIR/openrc demo demo
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_network {
|
function create_network {
|
||||||
@ -256,12 +262,8 @@ function create_network {
|
|||||||
source $TOP_DIR/openrc $TENANT $TENANT
|
source $TOP_DIR/openrc $TENANT $TENANT
|
||||||
local NET_ID=$(quantum net-create --tenant_id $TENANT_ID $NET_NAME $EXTRA| grep ' id ' | awk '{print $4}' )
|
local NET_ID=$(quantum net-create --tenant_id $TENANT_ID $NET_NAME $EXTRA| grep ' id ' | awk '{print $4}' )
|
||||||
quantum subnet-create --ip_version 4 --tenant_id $TENANT_ID --gateway $GATEWAY $NET_ID $CIDR
|
quantum subnet-create --ip_version 4 --tenant_id $TENANT_ID --gateway $GATEWAY $NET_ID $CIDR
|
||||||
#T0DO(nati) comment out until l3-agent is merged
|
quantum-debug probe-create $NET_ID
|
||||||
#local ROUTER_ID=$($QUANTUM router-create --tenant_id $TENANT_ID $ROUTER_NAME| grep ' id ' | awk '{print $4}' )
|
source $TOP_DIR/openrc demo demo
|
||||||
#for NET_NAME in ${NET_NAMES//,/ };do
|
|
||||||
# SUBNET_ID=`get_subnet_id $NET_NAME`
|
|
||||||
# $QUANTUM router-interface-create $NAME --subnet_id $SUBNET_ID
|
|
||||||
#done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_networks {
|
function create_networks {
|
||||||
@ -285,7 +287,7 @@ function create_vm {
|
|||||||
done
|
done
|
||||||
#TODO (nati) Add multi-nic test
|
#TODO (nati) Add multi-nic test
|
||||||
#TODO (nati) Add public-net test
|
#TODO (nati) Add public-net test
|
||||||
local VM_UUID=`nova --no_cache boot --flavor $(get_flavor_id m1.tiny) \
|
local VM_UUID=`nova boot --flavor $(get_flavor_id m1.tiny) \
|
||||||
--image $(get_image_id) \
|
--image $(get_image_id) \
|
||||||
$NIC \
|
$NIC \
|
||||||
$TENANT-server$NUM | grep ' id ' | cut -d"|" -f3 | sed 's/ //g'`
|
$TENANT-server$NUM | grep ' id ' | cut -d"|" -f3 | sed 's/ //g'`
|
||||||
@ -301,32 +303,26 @@ function ping_ip {
|
|||||||
# Test agent connection. Assumes namespaces are disabled, and
|
# Test agent connection. Assumes namespaces are disabled, and
|
||||||
# that DHCP is in use, but not L3
|
# that DHCP is in use, but not L3
|
||||||
local VM_NAME=$1
|
local VM_NAME=$1
|
||||||
IP=`nova --no_cache show $VM_NAME | grep 'network' | awk '{print $5}'`
|
local NET_NAME=$2
|
||||||
if ! timeout $BOOT_TIMEOUT sh -c "while ! ping -c1 -w1 $IP; do sleep 1; done"; then
|
IP=`nova show $VM_NAME | grep 'network' | awk '{print $5}'`
|
||||||
echo "Could not ping $VM_NAME"
|
ping_check $NET_NAME $IP $BOOT_TIMEOUT
|
||||||
false
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_vm {
|
function check_vm {
|
||||||
local TENANT=$1
|
local TENANT=$1
|
||||||
local NUM=$2
|
local NUM=$2
|
||||||
local VM_NAME="$TENANT-server$NUM"
|
local VM_NAME="$TENANT-server$NUM"
|
||||||
|
local NET_NAME=$3
|
||||||
source $TOP_DIR/openrc $TENANT $TENANT
|
source $TOP_DIR/openrc $TENANT $TENANT
|
||||||
ping_ip $VM_NAME
|
ping_ip $VM_NAME $NET_NAME
|
||||||
# TODO (nati) test ssh connection
|
# TODO (nati) test ssh connection
|
||||||
# TODO (nati) test inter connection between vm
|
# TODO (nati) test inter connection between vm
|
||||||
# TODO (nati) test namespace dhcp
|
|
||||||
# TODO (nati) test dhcp host routes
|
# TODO (nati) test dhcp host routes
|
||||||
# TODO (nati) test multi-nic
|
# TODO (nati) test multi-nic
|
||||||
# TODO (nati) use test-agent
|
|
||||||
# TODO (nati) test L3 forwarding
|
|
||||||
# TODO (nati) test floating ip
|
|
||||||
# TODO (nati) test security group
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_vms {
|
function check_vms {
|
||||||
foreach_tenant_vm 'check_vm ${%TENANT%_NAME} %NUM%'
|
foreach_tenant_vm 'check_vm ${%TENANT%_NAME} %NUM% ${%TENANT%_VM%NUM%_NET}'
|
||||||
}
|
}
|
||||||
|
|
||||||
function shutdown_vm {
|
function shutdown_vm {
|
||||||
@ -334,12 +330,12 @@ function shutdown_vm {
|
|||||||
local NUM=$2
|
local NUM=$2
|
||||||
source $TOP_DIR/openrc $TENANT $TENANT
|
source $TOP_DIR/openrc $TENANT $TENANT
|
||||||
VM_NAME=${TENANT}-server$NUM
|
VM_NAME=${TENANT}-server$NUM
|
||||||
nova --no_cache delete $VM_NAME
|
nova delete $VM_NAME
|
||||||
}
|
}
|
||||||
|
|
||||||
function shutdown_vms {
|
function shutdown_vms {
|
||||||
foreach_tenant_vm 'shutdown_vm ${%TENANT%_NAME} %NUM%'
|
foreach_tenant_vm 'shutdown_vm ${%TENANT%_NAME} %NUM%'
|
||||||
if ! timeout $TERMINATE_TIMEOUT sh -c "while nova --no_cache list | grep -q ACTIVE; do sleep 1; done"; then
|
if ! timeout $TERMINATE_TIMEOUT sh -c "while nova list | grep -q ACTIVE; do sleep 1; done"; then
|
||||||
echo "Some VMs failed to shutdown"
|
echo "Some VMs failed to shutdown"
|
||||||
false
|
false
|
||||||
fi
|
fi
|
||||||
@ -347,17 +343,22 @@ function shutdown_vms {
|
|||||||
|
|
||||||
function delete_network {
|
function delete_network {
|
||||||
local TENANT=$1
|
local TENANT=$1
|
||||||
|
local NUM=$2
|
||||||
|
local NET_NAME="${TENANT}-net$NUM"
|
||||||
source $TOP_DIR/openrc admin admin
|
source $TOP_DIR/openrc admin admin
|
||||||
local TENANT_ID=$(get_tenant_id $TENANT)
|
local TENANT_ID=$(get_tenant_id $TENANT)
|
||||||
#TODO(nati) comment out until l3-agent merged
|
#TODO(nati) comment out until l3-agent merged
|
||||||
#for res in port subnet net router;do
|
#for res in port subnet net router;do
|
||||||
for res in port subnet net;do
|
for net_id in `quantum net-list -c id -c name | grep $NET_NAME | awk '{print $2}'`;do
|
||||||
quantum ${res}-list -F id -F tenant_id | grep $TENANT_ID | awk '{print $2}' | xargs -I % quantum ${res}-delete %
|
delete_probe $net_id
|
||||||
|
quantum subnet-list | grep $net_id | awk '{print $2}' | xargs -I% quantum subnet-delete %
|
||||||
|
quantum net-delete $net_id
|
||||||
done
|
done
|
||||||
|
source $TOP_DIR/openrc demo demo
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete_networks {
|
function delete_networks {
|
||||||
foreach_tenant 'delete_network ${%TENANT%_NAME}'
|
foreach_tenant_net 'delete_network ${%TENANT%_NAME} ${%NUM%}'
|
||||||
#TODO(nati) add secuirty group check after it is implemented
|
#TODO(nati) add secuirty group check after it is implemented
|
||||||
# source $TOP_DIR/openrc demo1 demo1
|
# source $TOP_DIR/openrc demo1 demo1
|
||||||
# nova secgroup-delete-rule default icmp -1 -1 0.0.0.0/0
|
# nova secgroup-delete-rule default icmp -1 -1 0.0.0.0/0
|
||||||
@ -474,6 +475,7 @@ main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
teardown_quantum
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Kick off script.
|
# Kick off script.
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
@ -30,6 +30,12 @@ source $TOP_DIR/functions
|
|||||||
# Import configuration
|
# Import configuration
|
||||||
source $TOP_DIR/openrc
|
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
|
# Import exercise configuration
|
||||||
source $TOP_DIR/exerciserc
|
source $TOP_DIR/exerciserc
|
||||||
|
|
||||||
@ -206,6 +212,10 @@ fi
|
|||||||
# Delete a secgroup
|
# Delete a secgroup
|
||||||
nova secgroup-delete $SECGROUP || die "Failure deleting security group $SECGROUP"
|
nova secgroup-delete $SECGROUP || die "Failure deleting security group $SECGROUP"
|
||||||
|
|
||||||
|
if is_service_enabled quantum; then
|
||||||
|
teardown_quantum
|
||||||
|
fi
|
||||||
|
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
echo "*********************************************************************"
|
echo "*********************************************************************"
|
||||||
echo "SUCCESS: End DevStack Exercise: $0"
|
echo "SUCCESS: End DevStack Exercise: $0"
|
||||||
|
30
functions
30
functions
@ -872,7 +872,11 @@ function yum_install() {
|
|||||||
# ping check
|
# ping check
|
||||||
# Uses globals ``ENABLED_SERVICES``
|
# Uses globals ``ENABLED_SERVICES``
|
||||||
function ping_check() {
|
function ping_check() {
|
||||||
_ping_check_novanet "$1" $2 $3
|
if is_service_enabled quantum; then
|
||||||
|
_ping_check_quantum "$1" $2 $3 $4
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
_ping_check_novanet "$1" $2 $3 $4
|
||||||
}
|
}
|
||||||
|
|
||||||
# ping check for nova
|
# ping check for nova
|
||||||
@ -881,19 +885,39 @@ function _ping_check_novanet() {
|
|||||||
local from_net=$1
|
local from_net=$1
|
||||||
local ip=$2
|
local ip=$2
|
||||||
local boot_timeout=$3
|
local boot_timeout=$3
|
||||||
|
local expected=${4:-"True"}
|
||||||
|
local check_command=""
|
||||||
MULTI_HOST=`trueorfalse False $MULTI_HOST`
|
MULTI_HOST=`trueorfalse False $MULTI_HOST`
|
||||||
if [[ "$MULTI_HOST" = "True" && "$from_net" = "$PRIVATE_NETWORK_NAME" ]]; then
|
if [[ "$MULTI_HOST" = "True" && "$from_net" = "$PRIVATE_NETWORK_NAME" ]]; then
|
||||||
sleep $boot_timeout
|
sleep $boot_timeout
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if ! timeout $boot_timeout sh -c "while ! ping -c1 -w1 $ip; do sleep 1; done"; then
|
if [[ "$expected" = "True" ]]; then
|
||||||
echo "Couldn't ping server"
|
check_command="while ! ping -c1 -w1 $ip; do sleep 1; done"
|
||||||
|
else
|
||||||
|
check_command="while ping -c1 -w1 $ip; do sleep 1; done"
|
||||||
|
fi
|
||||||
|
if ! timeout $boot_timeout sh -c "$check_command"; then
|
||||||
|
if [[ "$expected" = "True" ]]; then
|
||||||
|
echo "[Fail] Couldn't ping server"
|
||||||
|
else
|
||||||
|
echo "[Fail] Could ping server"
|
||||||
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# ssh check
|
# ssh check
|
||||||
|
|
||||||
function ssh_check() {
|
function ssh_check() {
|
||||||
|
if is_service_enabled quantum; then
|
||||||
|
_ssh_check_quantum "$1" $2 $3 $4 $5
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
_ssh_check_novanet "$1" $2 $3 $4 $5
|
||||||
|
}
|
||||||
|
|
||||||
|
function _ssh_check_novanet() {
|
||||||
local NET_NAME=$1
|
local NET_NAME=$1
|
||||||
local KEY_FILE=$2
|
local KEY_FILE=$2
|
||||||
local FLOATING_IP=$3
|
local FLOATING_IP=$3
|
||||||
|
69
lib/quantum
69
lib/quantum
@ -5,6 +5,8 @@
|
|||||||
XTRACE=$(set +o | grep xtrace)
|
XTRACE=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
|
|
||||||
|
export QUANTUM_TEST_CONFIG_FILE=${QUANTUM_TEST_CONFIG_FILE:-"/etc/quantum/debug.ini"}
|
||||||
|
|
||||||
# Configures keystone integration for quantum service and agents
|
# Configures keystone integration for quantum service and agents
|
||||||
function quantum_setup_keystone() {
|
function quantum_setup_keystone() {
|
||||||
local conf_file=$1
|
local conf_file=$1
|
||||||
@ -57,5 +59,72 @@ function is_quantum_ovs_base_plugin() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _get_net_id() {
|
||||||
|
quantum --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD net-list | grep $1 | awk '{print $2}'
|
||||||
|
}
|
||||||
|
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete_probe() {
|
||||||
|
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}'`
|
||||||
|
quantum-debug --os-tenant-name admin --os-username admin probe-delete $probe_id
|
||||||
|
}
|
||||||
|
|
||||||
|
function _ping_check_quantum() {
|
||||||
|
local from_net=$1
|
||||||
|
local ip=$2
|
||||||
|
local timeout_sec=$3
|
||||||
|
local expected=${4:-"True"}
|
||||||
|
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"
|
||||||
|
else
|
||||||
|
check_command="while $probe_cmd ping -c1 -w1 $ip; do sleep 1; done"
|
||||||
|
fi
|
||||||
|
if ! timeout $timeout_sec sh -c "$check_command"; then
|
||||||
|
if [[ "$expected" = "True" ]]; then
|
||||||
|
echo "[Fail] Couldn't ping server"
|
||||||
|
else
|
||||||
|
echo "[Fail] Could ping server"
|
||||||
|
fi
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# ssh check
|
||||||
|
function _ssh_check_quantum() {
|
||||||
|
local from_net=$1
|
||||||
|
local key_file=$2
|
||||||
|
local ip=$3
|
||||||
|
local user=$4
|
||||||
|
local timeout_sec=$5
|
||||||
|
local probe_cmd = ""
|
||||||
|
probe_cmd=`_get_probe_cmd_prefix $from_net`
|
||||||
|
if ! timeout $timeout_sec sh -c "while ! $probe_cmd ssh -o StrictHostKeyChecking=no -i $key_file ${user}@$ip echo success ; do sleep 1; done"; then
|
||||||
|
echo "server didn't become ssh-able!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function setup_quantum() {
|
||||||
|
public_net_id=`_get_net_id $PUBLIC_NETWORK_NAME`
|
||||||
|
quantum-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create $public_net_id
|
||||||
|
private_net_id=`_get_net_id $PRIVATE_NETWORK_NAME`
|
||||||
|
quantum-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create $private_net_id
|
||||||
|
}
|
||||||
|
|
||||||
|
function teardown_quantum() {
|
||||||
|
delete_probe $PUBLIC_NETWORK_NAME
|
||||||
|
delete_probe $PRIVATE_NETWORK_NAME
|
||||||
|
}
|
||||||
|
|
||||||
# Restore xtrace
|
# Restore xtrace
|
||||||
$XTRACE
|
$XTRACE
|
||||||
|
4
openrc
4
openrc
@ -73,5 +73,5 @@ export COMPUTE_API_VERSION=${COMPUTE_API_VERSION:-$NOVA_VERSION}
|
|||||||
# export KEYSTONECLIENT_DEBUG=1
|
# export KEYSTONECLIENT_DEBUG=1
|
||||||
# export NOVACLIENT_DEBUG=1
|
# export NOVACLIENT_DEBUG=1
|
||||||
|
|
||||||
# set qunatum debug command
|
# set quantum debug command
|
||||||
export TEST_CONFIG_FILE=/etc/quantum/debug.ini
|
export QUANTUM_TEST_CONFIG_FILE=${QUANTUM_TEST_CONFIG_FILE:-"/etc/quantum/debug.ini"}
|
||||||
|
11
stack.sh
11
stack.sh
@ -342,6 +342,8 @@ Q_USE_NAMESPACE=${Q_USE_NAMESPACE:-True}
|
|||||||
Q_USE_ROOTWRAP=${Q_USE_ROOTWRAP:-True}
|
Q_USE_ROOTWRAP=${Q_USE_ROOTWRAP:-True}
|
||||||
# Meta data IP
|
# Meta data IP
|
||||||
Q_META_DATA_IP=${Q_META_DATA_IP:-$HOST_IP}
|
Q_META_DATA_IP=${Q_META_DATA_IP:-$HOST_IP}
|
||||||
|
# Use quantum-debug command
|
||||||
|
Q_USE_DEBUG_COMMAND=${Q_USE_DEBUG_COMMAND:-False}
|
||||||
|
|
||||||
RYU_DIR=$DEST/ryu
|
RYU_DIR=$DEST/ryu
|
||||||
# Ryu API Host
|
# Ryu API Host
|
||||||
@ -1465,6 +1467,15 @@ if is_service_enabled quantum; then
|
|||||||
iniset $Q_CONF_FILE DEFAULT rabbit_host $RABBIT_HOST
|
iniset $Q_CONF_FILE DEFAULT rabbit_host $RABBIT_HOST
|
||||||
iniset $Q_CONF_FILE DEFAULT rabbit_password $RABBIT_PASSWORD
|
iniset $Q_CONF_FILE DEFAULT rabbit_password $RABBIT_PASSWORD
|
||||||
fi
|
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"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user