Merge "init-runonce: make public1 network optional"

This commit is contained in:
Zuul 2019-07-11 09:30:53 +00:00 committed by Gerrit Code Review
commit 103e0e43e7
1 changed files with 11 additions and 6 deletions

View File

@ -15,6 +15,7 @@ IMAGE_NAME=cirros
IMAGE_TYPE=linux
# This EXT_NET_CIDR is your public network,that you want to connect to the internet via.
ENABLE_EXT_NET=${ENABLE_EXT_NET:-1}
EXT_NET_CIDR='10.0.2.0/24'
EXT_NET_RANGE='start=10.0.2.150,end=10.0.2.199'
EXT_NET_GATEWAY='10.0.2.1'
@ -66,11 +67,13 @@ openstack image create --disk-format qcow2 --container-format bare --public \
--property os_type=${IMAGE_TYPE} --file ${IMAGE_PATH}/${IMAGE} ${IMAGE_NAME}
echo Configuring neutron.
openstack network create --external --provider-physical-network physnet1 \
--provider-network-type flat public1
openstack subnet create --no-dhcp \
--allocation-pool ${EXT_NET_RANGE} --network public1 \
--subnet-range ${EXT_NET_CIDR} --gateway ${EXT_NET_GATEWAY} public1-subnet
if [[ $ENABLE_EXT_NET -eq 1 ]]; then
openstack network create --external --provider-physical-network physnet1 \
--provider-network-type flat public1
openstack subnet create --no-dhcp \
--allocation-pool ${EXT_NET_RANGE} --network public1 \
--subnet-range ${EXT_NET_CIDR} --gateway ${EXT_NET_GATEWAY} public1-subnet
fi
openstack network create --provider-network-type vxlan demo-net
openstack subnet create --subnet-range 10.0.0.0/24 --network demo-net \
@ -78,7 +81,9 @@ openstack subnet create --subnet-range 10.0.0.0/24 --network demo-net \
openstack router create demo-router
openstack router add subnet demo-router demo-subnet
openstack router set --external-gateway public1 demo-router
if [[ $ENABLE_EXT_NET -eq 1 ]]; then
openstack router set --external-gateway public1 demo-router
fi
# Get admin user and tenant IDs
ADMIN_USER_ID=$(openstack user list | awk '/ admin / {print $2}')