NETWORK_MODE switch added.

Additional parameter was introduced to allow quick switch between two possible networking modes.

Change-Id: I9ef2b8b3feed6e647bd384727dc0f1a16b2000e4
This commit is contained in:
Dmitry Teselkin 2013-05-17 17:26:42 +04:00
parent de15615fdb
commit 5c5fd0436d
3 changed files with 39 additions and 31 deletions

View File

@ -11,6 +11,7 @@ NOVA_CACHE_TMPFS_SIZE=24G
GLANCE_IMAGE_LIST="" GLANCE_IMAGE_LIST=""
COMPUTE_NODE_LIST="" COMPUTE_NODE_LIST=""
NETWORK_MODE="nova"
LAB_FLAT_RANGE=172.18.124.192/26 LAB_FLAT_RANGE=172.18.124.192/26
LAB_ALLOCATION_START=172.18.124.210 LAB_ALLOCATION_START=172.18.124.210

View File

@ -39,16 +39,18 @@ function glance_image_create {
# Executing post-stack actions # Executing post-stack actions
#=============================================================================== #===============================================================================
#if [[ ',standalone,compute,' =~ ,$INSTALL_MODE, ]] ; then if [[ $NETWORK_MODE == "nova" ]] ; then
# echo "Adding iptables rule to allow Internet access from instances..." if [[ ',standalone,compute,' =~ ,$INSTALL_MODE, ]] ; then
# __iptables_rule="POSTROUTING -t nat -s '$FIXED_RANGE' ! -d '$FIXED_RANGE' -j MASQUERADE" echo "Adding iptables rule to allow Internet access from instances..."
# sudo iptables -C $__iptables_rule __iptables_rule="POSTROUTING -t nat -s '$FIXED_RANGE' ! -d '$FIXED_RANGE' -j MASQUERADE"
# if [[ $? == 0 ]] ; then sudo iptables -C $__iptables_rule
# echo "Iptables rule already exists." if [[ $? == 0 ]] ; then
# else echo "Iptables rule already exists."
# sudo iptables -A $__iptables_rule else
# fi sudo iptables -A $__iptables_rule
#fi fi
fi
fi
if [[ ',standalone,compute,' =~ ,$INSTALL_MODE, ]] ; then if [[ ',standalone,compute,' =~ ,$INSTALL_MODE, ]] ; then
@ -108,25 +110,27 @@ else
fi fi
quantum net-create Public \ if [[ $NETWORK_MODE == "quantum" ]] ; then
--tenant-id admin \ quantum net-create Public \
--shared \ --tenant-id admin \
--provider:network_type flat \ --shared \
--provider:physical_network Public --provider:network_type flat \
--provider:physical_network Public
quantum subnet-create \ quantum subnet-create \
--tenant-id admin \ --tenant-id admin \
--allocation-pool start=$LAB_ALLOCATION_START,end=$LAB_ALLOCATION_END \ --allocation-pool start=$LAB_ALLOCATION_START,end=$LAB_ALLOCATION_END \
--dns-nameserver $LAB_DNS_SERVER_1 \ --dns-nameserver $LAB_DNS_SERVER_1 \
--dns-nameserver $LAB_DNS_SERVER_2 \ --dns-nameserver $LAB_DNS_SERVER_2 \
Public \ Public \
$LAB_FLAT_RANGE $LAB_FLAT_RANGE
quantum port-create \ quantum port-create \
--tenant-id admin \ --tenant-id admin \
--device-id network:dhcp \ --device-id network:dhcp \
--fixed-ip subnet=Public,ip_address=$LAB_ALLOCATION_START \ --fixed-ip subnet=Public,ip_address=$LAB_ALLOCATION_START \
Public Public
fi
#=============================================================================== #===============================================================================

View File

@ -18,10 +18,13 @@ SERVICE_TOKEN=tokentoken
# Enable HEAT # Enable HEAT
ENABLED_SERVICES+=,heat,h-api,h-api-cfn,h-api-cw,h-eng ENABLED_SERVICES+=,heat,h-api,h-api-cfn,h-api-cw,h-eng
# Enable QUANTUM
ENABLED_SERVICES+=,q-svc,q-agt,q-dhcp,q-l3,q-meta,quantum if [[ $NETWORK_MODE == "quantum" ]] ; then
# Disable NOVA-NETWORK # Enable QUANTUM
DISABLED_SERVICES=n-net ENABLED_SERVICES+=,q-svc,q-agt,q-dhcp,q-l3,q-meta,quantum
# Disable NOVA-NETWORK
DISABLED_SERVICES=n-net
fi
SCREEN_LOGDIR=/opt/stack/log/ SCREEN_LOGDIR=/opt/stack/log/
LOGFILE=$SCREEN_LOGDIR/stack.sh.log LOGFILE=$SCREEN_LOGDIR/stack.sh.log