Add some additional floating ip pool testing

Change-Id: I62cd6b43e3250dc28d66dc84d3759f47e81ff134
This commit is contained in:
Dean Troyer 2012-01-10 15:34:34 -06:00
parent ea4a53da61
commit 696ad331a4
2 changed files with 32 additions and 4 deletions

View File

@ -24,6 +24,11 @@ pushd $(cd $(dirname "$0")/.. && pwd)
source ./openrc source ./openrc
popd popd
# Set some defaults
DEFAULT_FLOATING_POOL=${DEFAULT_FLOATING_POOL:-nova}
TEST_FLOATING_POOL=${TEST_FLOATING_POOL:-test}
# Get a token for clients that don't support service catalog # Get a token for clients that don't support service catalog
# ========================================================== # ==========================================================
@ -130,11 +135,14 @@ nova secgroup-add-rule $SECGROUP icmp -1 -1 0.0.0.0/0
# List rules for a secgroup # List rules for a secgroup
nova secgroup-list-rules $SECGROUP nova secgroup-list-rules $SECGROUP
# allocate a floating ip # allocate a floating ip from default pool
nova floating-ip-create FLOATING_IP=`nova floating-ip-create | grep $DEFAULT_FLOATING_POOL | cut -d '|' -f2`
# store floating address # list floating addresses
FLOATING_IP=`nova floating-ip-list | grep None | head -1 | cut -d '|' -f2 | sed 's/ //g'` if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova floating-ip-list | grep -q $FLOATING_IP; do sleep 1; done"; then
echo "Floating IP not allocated"
exit 1
fi
# add floating ip to our server # add floating ip to our server
nova add-floating-ip $NAME $FLOATING_IP nova add-floating-ip $NAME $FLOATING_IP
@ -145,6 +153,15 @@ if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! ping -c1 -w1 $FLOATING_IP; do sle
exit 1 exit 1
fi fi
# Allocate an IP from it
TEST_FLOATING_IP=`nova floating-ip-create $TEST_FLOATING_POOL | grep $TEST_FLOATING_POOL | cut -d '|' -f2`
# 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
echo "Floating IP not allocated"
exit 1
fi
# dis-allow icmp traffic (ping) # dis-allow icmp traffic (ping)
nova secgroup-delete-rule $SECGROUP icmp -1 -1 0.0.0.0/0 nova secgroup-delete-rule $SECGROUP icmp -1 -1 0.0.0.0/0
@ -161,6 +178,9 @@ fi
# de-allocate the floating ip # de-allocate the floating ip
nova floating-ip-delete $FLOATING_IP nova floating-ip-delete $FLOATING_IP
# Delete second floating IP
nova floating-ip-delete $TEST_FLOATING_IP
# shutdown the server # shutdown the server
nova delete $NAME nova delete $NAME

View File

@ -283,6 +283,11 @@ EC2_DMZ_HOST=${EC2_DMZ_HOST:-$SERVICE_HOST}
FLAT_NETWORK_BRIDGE=${FLAT_NETWORK_BRIDGE:-br100} FLAT_NETWORK_BRIDGE=${FLAT_NETWORK_BRIDGE:-br100}
VLAN_INTERFACE=${VLAN_INTERFACE:-$PUBLIC_INTERFACE} VLAN_INTERFACE=${VLAN_INTERFACE:-$PUBLIC_INTERFACE}
# Test floating pool and range are used for testing. They are defined
# here until the admin APIs can replace nova-manage
TEST_FLOATING_POOL=${TEST_FLOATING_POOL:-test}
TEST_FLOATING_RANGE=${TEST_FLOATING_RANGE:-192.168.253.0/29}
# Multi-host is a mode where each compute node runs its own network node. This # Multi-host is a mode where each compute node runs its own network node. This
# allows network operations and routing for a VM to occur on the server that is # allows network operations and routing for a VM to occur on the server that is
# running the VM - removing a SPOF and bandwidth bottleneck. # running the VM - removing a SPOF and bandwidth bottleneck.
@ -1327,6 +1332,9 @@ if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then
else else
# create some floating ips # create some floating ips
$NOVA_DIR/bin/nova-manage floating create $FLOATING_RANGE $NOVA_DIR/bin/nova-manage floating create $FLOATING_RANGE
# create a second pool
$NOVA_DIR/bin/nova-manage floating create --ip_range=$TEST_FLOATING_RANGE --pool=$TEST_FLOATING_POOL
fi fi
fi fi