init-runonce: make public1 network optional

Skip creation by setting ENABLE_EXT_NET to 0.

Since adding errexit we are failing in kayobe CI, since we have a
conflicting flat network on physnet1.

Change-Id: I88429f30eb81a286f4b8104d5e7a176eefaad667
(cherry picked from commit 3026fd9129)
This commit is contained in:
Mark Goddard 2019-07-10 17:48:28 +01:00
parent 4ecb540c1b
commit da6acef6ce

View File

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