From 8b43b801e31b67387ad89ecb232c17dd9c559ec0 Mon Sep 17 00:00:00 2001 From: Adam Gandelman Date: Wed, 3 Jun 2015 10:15:45 -0700 Subject: [PATCH] Various devstack cleanups * Do not create the public network if its been created already * Explicitly disable neutron services that do not need to run (they are enabled by default in the gate) * Remove subnets twice: There is some issue with the masking of port subne IDs we do that is causing issue when removing subnets in devstack. It works the second time? * Stop using a hard-coded network name * Stop q-svc using the correct function depending on screen config: stop_process pkills the thing and leaves a q-svc.failure flag file when using screen, that fails the devstack run. Change-Id: I5d088e2cb485a6ae74d45d738a0083cba4b66ff8 --- devstack/plugin.sh | 25 ++++++++++++++++--------- devstack/settings | 8 ++++++++ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 2201e49d..b5cfb098 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -126,24 +126,27 @@ function install_akanda() { } function _remove_subnets() { + # Attempt to delete subnets associated with a network. # We have to modify the output of net-show to allow it to be # parsed properly as shell variables, and we run both commands in # a subshell to avoid polluting the local namespace. (eval $(neutron $auth_args net-show -f shell $1 | sed 's/:/_/g'); - neutron $auth_args subnet-delete $subnets) - + neutron $auth_args subnet-delete $subnets || true) } function pre_start_akanda() { typeset auth_args="--os-username $Q_ADMIN_USERNAME --os-password $SERVICE_PASSWORD --os-tenant-name $SERVICE_TENANT_NAME --os-auth-url $OS_AUTH_URL" - neutron $auth_args net-create public --router:external + if ! neutron net-show $PUBLIC_NETWORK_NAME; then + neutron $auth_args net-create $PUBLIC_NETWORK_NAME --router:external + fi # Remove the ipv6 subnet created automatically before adding our own. - _remove_subnets public + # NOTE(adam_g): For some reason this fails the first time and needs to be repeated? + _remove_subnets $PUBLIC_NETWORK_NAME ; _remove_subnets $PUBLIC_NETWORK_NAME - typeset public_subnet_id=$(neutron $auth_args subnet-create --ip-version 4 public 172.16.77.0/24 | grep ' id ' | awk '{ print $4 }') + typeset public_subnet_id=$(neutron $auth_args subnet-create --ip-version 4 $PUBLIC_NETWORK_NAME 172.16.77.0/24 | grep ' id ' | awk '{ print $4 }') iniset $AKANDA_RUG_CONF DEFAULT external_subnet_id $public_subnet_id - neutron $auth_args subnet-create --ip-version 6 public fdee:9f85:83be::/48 + neutron $auth_args subnet-create --ip-version 6 $PUBLIC_NETWORK_NAME fdee:9f85:83be::/48 # Point neutron-akanda at the subnet to use for floating IPs. This requires a neutron service restart (later) to take effect. iniset $NEUTRON_CONF akanda floatingip_subnet $public_subnet_id @@ -151,9 +154,9 @@ function pre_start_akanda() { # setup masq rule for public network sudo iptables -t nat -A POSTROUTING -s 172.16.77.0/24 -o $PUBLIC_INTERFACE_DEFAULT -j MASQUERADE - neutron $auth_args net-show public | grep ' id ' | awk '{ print $4 }' + neutron $auth_args net-show $PUBLIC_NETWORK_NAME | grep ' id ' | awk '{ print $4 }' - typeset public_network_id=$(neutron $auth_args net-show public | grep ' id ' | awk '{ print $4 }') + typeset public_network_id=$(neutron $auth_args net-show $PUBLIC_NETWORK_NAME | grep ' id ' | awk '{ print $4 }') iniset $AKANDA_RUG_CONF DEFAULT external_network_id $public_network_id neutron $auth_args net-create mgt @@ -226,7 +229,11 @@ function post_start_akanda() { subnet-create thenet 192.168.0.0/24 # Restart neutron so that `akanda.floatingip_subnet` is properly set - screen_stop_service q-svc + if [[ "$USE_SCREEN" == "True" ]]; then + screen_stop_service q-svc + else + stop_process q-svc + fi start_neutron_service_and_check # Due to a bug in security groups we need to enable udp ingress traffic diff --git a/devstack/settings b/devstack/settings index 7bb5c35f..e848890a 100644 --- a/devstack/settings +++ b/devstack/settings @@ -1 +1,9 @@ AKANDA_RUG_DIR=$DEST/akanda-rug + +for svc in q-dhcp q-l3 q-fwaas q-lbaas q-meta q-vpn; do + if is_service_enabled $svc; then + echo "Disabling $svc in favor of Akanda." + disable_service $svc + fi +done +Q_USE_DEBUG_COMMAND=False