Devstack - use neutron segments (routed provider networks)

When IRONIC_USE_NEUTRON_SEGMENTS is True:
* The provisioning subnet is associated with the segment on the
  provisioning network.
* The baremetal node ports is created with --physical-network set.

The neutron segments service_plugin must be enabled to allow
associating the subnet with the segment.

Change-Id: Ie6dcebf24413c65ecdc3e0c56cc56f8d88dc406c
This commit is contained in:
Harald Jensas 2018-01-05 00:45:57 +01:00
parent 180234b445
commit d0d78a86de
1 changed files with 17 additions and 1 deletions

View File

@ -373,6 +373,10 @@ IRONIC_PROVISION_ALLOCATION_POOL=${IRONIC_PROVISION_ALLOCATION_POOL:-'start=10.0
# This is only used if IRONIC_PROVISION_NETWORK_NAME has been set.
IRONIC_PROVISION_PROVIDER_SUBNET_NAME=${IRONIC_PROVISION_PROVIDER_SUBNET_NAME:-${IRONIC_PROVISION_NETWORK_NAME}-subnet}
# When enabled this will set the physical_network attribute for ironic ports
# and subnet-to-segment association on provisioning network will be configured.
# NOTE: The neutron segments service_plugin must be loaded for this.
IRONIC_USE_NEUTRON_SEGMENTS=$(trueorfalse False IRONIC_USE_NEUTRON_SEGMENTS)
# This is the storage interface to use for a node
# Only 'cinder' can be set for testing boot from volume
@ -990,9 +994,17 @@ function configure_ironic_provision_network {
${IRONIC_PROVISION_NETWORK_NAME} -f value -c id)
die_if_not_set $LINENO net_id "Failure creating net_id for $IRONIC_PROVISION_NETWORK_NAME"
if [[ "${IRONIC_USE_NEUTRON_SEGMENTS}" == "True" ]]; then
local net_segment_id
net_segment_id=$(openstack network segment list --network $net_id -f value -c ID)
die_if_not_set $LINENO net_segment_id "Failure getting net_segment_id for $IRONIC_PROVISION_NETWORK_NAME"
fi
local subnet_id
subnet_id="$(openstack subnet create --ip-version 4 \
${IRONIC_PROVISION_ALLOCATION_POOL:+--allocation-pool $IRONIC_PROVISION_ALLOCATION_POOL} \
${net_segment_id:+--network-segment $net_segment_id} \
$IRONIC_PROVISION_PROVIDER_SUBNET_NAME \
--gateway $IRONIC_PROVISION_SUBNET_GATEWAY --network $net_id \
--subnet-range $IRONIC_PROVISION_SUBNET_PREFIX -f value -c id)"
@ -1895,12 +1907,16 @@ function enroll_nodes {
local mac_address=""
local port_id=""
local llc_port_opt=""
local physical_network=""
mac_address=$(echo $info| awk -F ',' '{print $1}')
port_id=$(echo $info| awk -F ',' '{print $2}')
if [[ "${IRONIC_USE_LINK_LOCAL}" == "True" ]]; then
llc_port_opt+=" --local-link-connection port_id=${port_id} "
fi
$IRONIC_CMD port create --node $node_id $llc_opts $llc_port_opt $mac_address
if [[ "${IRONIC_USE_NEUTRON_SEGMENTS}" == "True" ]]; then
physical_network=" --physical-network ${PHYSICAL_NETWORK} "
fi
$IRONIC_CMD port create --node $node_id $llc_opts $llc_port_opt $mac_address $physical_network
done
# NOTE(vsaienko) use node-update instead of specifying network_interface