From 15de01a5f606984425494553af9131ef16b6f62f Mon Sep 17 00:00:00 2001 From: Pavlo Shchelokovskyy Date: Wed, 3 Aug 2016 19:06:35 +0300 Subject: [PATCH] Configure clean network to provision network Currently when setting up Ironic with multi-tenancy support, the DevStack plugin by default still sets the cleaning network to the default private network of the demo project, which is not exactly correct. Change the DevStack plugin so that the cleaning network is the same as provisioning network if IRONIC_CLEAN_NET_NAME is not set: - In case of multi-tenancy support enabled, use the created separate provisioning network - w/o multi-tenancy support use the default private network. If the IRONIC_CLEAN_NET_NAME is provided, use that. Change-Id: I9db8f5e3000f05d27a3fa8fc94cfdafe34a6f48a --- devstack/lib/ironic | 28 +++++++++++++++++++--------- devstack/plugin.sh | 7 ++++--- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/devstack/lib/ironic b/devstack/lib/ironic index 5c4187c41e..12aaa58081 100644 --- a/devstack/lib/ironic +++ b/devstack/lib/ironic @@ -124,7 +124,7 @@ IRONIC_VM_NETWORK_BRIDGE=${IRONIC_VM_NETWORK_BRIDGE:-brbm} IRONIC_VM_NETWORK_RANGE=${IRONIC_VM_NETWORK_RANGE:-192.0.2.0/24} IRONIC_VM_MACS_CSV_FILE=${IRONIC_VM_MACS_CSV_FILE:-$IRONIC_DATA_DIR/ironic_macs.csv} IRONIC_AUTHORIZED_KEYS_FILE=${IRONIC_AUTHORIZED_KEYS_FILE:-$HOME/.ssh/authorized_keys} -IRONIC_CLEAN_NET_NAME=${IRONIC_CLEAN_NET_NAME:-$PRIVATE_NETWORK_NAME} +IRONIC_CLEAN_NET_NAME=${IRONIC_CLEAN_NET_NAME:-${IRONIC_PROVISION_NETWORK_NAME:-${PRIVATE_NETWORK_NAME}}} IRONIC_EXTRA_PXE_PARAMS=${IRONIC_EXTRA_PXE_PARAMS:-} IRONIC_TTY_DEV=${IRONIC_TTY_DEV:-ttyS0} @@ -506,6 +506,24 @@ function configure_ironic_dirs { fi } +function configure_ironic_networks { + + if [[ -n "${IRONIC_PROVISION_NETWORK_NAME}" ]]; then + echo_summary "Configuring Ironic provisioning network" + configure_ironic_provision_network + fi + + echo_summary "Configuring Ironic cleaning network" + configure_ironic_cleaning_network +} + +function configure_ironic_cleaning_network { + local cleaning_network_uuid + cleaning_network_uuid=$(openstack network show "$IRONIC_CLEAN_NET_NAME" -c id -f value) + die_if_not_set $LINENO cleaning_network_uuid "Failed to get ironic cleaning network id" + iniset $IRONIC_CONF_FILE neutron cleaning_network_uuid ${cleaning_network_uuid} +} + function configure_ironic_provision_network { die_if_not_set $LINENO IRONIC_PROVISION_SUBNET_PREFIX "You must specify the IRONIC_PROVISION_SUBNET_PREFIX" @@ -782,14 +800,6 @@ function create_ironic_accounts { # init_ironic() - Initialize databases, etc. function init_ironic { - if is_service_enabled neutron; then - # Save private network as cleaning network - local cleaning_network_uuid - cleaning_network_uuid=$(openstack network show "$IRONIC_CLEAN_NET_NAME" -c id -f value) - die_if_not_set $LINENO cleaning_network_uuid "Failed to get ironic cleaning network id" - iniset $IRONIC_CONF_FILE neutron cleaning_network_uuid ${cleaning_network_uuid} - fi - # (Re)create ironic database recreate_database ironic diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 30b5d9daae..5a7b5f660a 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -41,9 +41,10 @@ if is_service_enabled ir-api ir-cond; then echo_summary "Creating bridge and VMs" create_bridge_and_vms fi - if [[ -n "${IRONIC_PROVISION_NETWORK_NAME}" ]]; then - echo_summary "Configuring Ironic provisioning network" - configure_ironic_provision_network + + if is_service_enabled neutron; then + echo_summary "Configuring Ironic networks" + configure_ironic_networks fi # Start the ironic API and ironic taskmgr components