From 3026fd91298ea9f33d8aa5cd57bc0ae7ea6abf98 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Wed, 10 Jul 2019 17:48:28 +0100 Subject: [PATCH] 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 --- tools/init-runonce | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tools/init-runonce b/tools/init-runonce index edbb490b5e..34d1c71663 100755 --- a/tools/init-runonce +++ b/tools/init-runonce @@ -13,6 +13,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' @@ -64,11 +65,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 \ @@ -76,7 +79,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}')