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=""
COMPUTE_NODE_LIST=""
NETWORK_MODE="nova"
LAB_FLAT_RANGE=172.18.124.192/26
LAB_ALLOCATION_START=172.18.124.210

View File

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

View File

@ -18,10 +18,13 @@ SERVICE_TOKEN=tokentoken
# Enable HEAT
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
# Disable NOVA-NETWORK
DISABLED_SERVICES=n-net
if [[ $NETWORK_MODE == "quantum" ]] ; then
# Enable QUANTUM
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/
LOGFILE=$SCREEN_LOGDIR/stack.sh.log