From 07edde1c14d8ab91533c1ef6fe0470f088d5c8bb Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Wed, 19 Oct 2016 19:21:00 +0000 Subject: [PATCH] lib/neutron: Create initial topology only on controller node To avoid it being created multiple times for multinode setup. Note: This reverts "Enable neutron to work in a multi node setup" (commit 88f8558d874072536e7660a233f24207a7089651) partly and fixes the issue differently. The configuration in question uses the new lib/neutron. (not neutron-legacy) In that case, calling create_neutron_initial_network from stack.sh directly is a wrong way, as create_neutron_initial_network is sourced by neutron-legacy. The new neutron code should not rely on the legacy one. Closes-Bug: #1613069 Change-Id: I868afeb065d80d8ccd57630b90658e330ab94251 --- lib/neutron | 20 +++++++++++--------- lib/neutron_plugins/services/l3 | 8 -------- stack.sh | 5 ++++- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/lib/neutron b/lib/neutron index 53fc5fcd15..9923721e74 100644 --- a/lib/neutron +++ b/lib/neutron @@ -431,15 +431,17 @@ function start_neutron_new { if is_service_enabled neutron-l3; then run_process neutron-l3 "$NEUTRON_BIN_DIR/$NEUTRON_L3_BINARY $NEUTRON_CONFIG_ARG" fi - # XXX(sc68cal) - Here's where plugins can wire up their own networks instead - # of the code in lib/neutron_plugins/services/l3 - if type -p neutron_plugin_create_initial_networks > /dev/null; then - neutron_plugin_create_initial_networks - else - # XXX(sc68cal) Load up the built in Neutron networking code and build a topology - source $TOP_DIR/lib/neutron_plugins/services/l3 - # Create the networks using servic - create_neutron_initial_network + if is_service_enabled neutron-api; then + # XXX(sc68cal) - Here's where plugins can wire up their own networks instead + # of the code in lib/neutron_plugins/services/l3 + if type -p neutron_plugin_create_initial_networks > /dev/null; then + neutron_plugin_create_initial_networks + else + # XXX(sc68cal) Load up the built in Neutron networking code and build a topology + source $TOP_DIR/lib/neutron_plugins/services/l3 + # Create the networks using servic + create_neutron_initial_network + fi fi if is_service_enabled neutron-metadata-agent; then run_process neutron-metadata-agent "$NEUTRON_BIN_DIR/$NEUTRON_META_BINARY $NEUTRON_CONFIG_ARG" diff --git a/lib/neutron_plugins/services/l3 b/lib/neutron_plugins/services/l3 index aa61a109fa..9c9143a225 100644 --- a/lib/neutron_plugins/services/l3 +++ b/lib/neutron_plugins/services/l3 @@ -154,14 +154,6 @@ function _neutron_get_ext_gw_interface { } function create_neutron_initial_network { - if ! is_service_enabled q-svc && ! is_service_enabled neutron-api; then - echo "Controller services not enabled. No networks configured!" - return - fi - if [[ "$NEUTRON_CREATE_INITIAL_NETWORKS" == "False" ]]; then - echo "Network creation disabled!" - return - fi local project_id project_id=$(openstack project list | grep " demo " | get_field 1) die_if_not_set $LINENO project_id "Failure retrieving project_id for demo" diff --git a/stack.sh b/stack.sh index fab2edd299..2783efed6b 100755 --- a/stack.sh +++ b/stack.sh @@ -1267,7 +1267,10 @@ if is_service_enabled neutron; then start_neutron fi # Once neutron agents are started setup initial network elements -create_neutron_initial_network +if is_service_enabled q-svc && [[ "$NEUTRON_CREATE_INITIAL_NETWORKS" == "True" ]]; then + echo_summary "Creating initial neutron network elements" + create_neutron_initial_network +fi if is_service_enabled nova; then echo_summary "Starting Nova"