Use a single Neutron port for bmc

The original single bmc change configured the bmc instance with
two Neutron ports.  This was done mostly to avoid some extra
manual network configuration in the bmc instance, but it resulted
in duplicate routes to the private network.  Recently it has come
to my attention that Ironic is having intermittent problems
talking to the bmc instance, which may be caused by this duplicate
route.  I had similar problems with the initial single bmc change
because it added N routes to the bmc when N baremetal instances
were created.  Reducing the duplicate routes probably mitigated
the problem, but didn't eliminate it.

This change switches to a single Neutron port for the bmc and does
the necessary configuration via os-net-config so the default route
and the Neutron assigned address will continue to work.  It also
removes the note in the documentation about needing to allow
multiple ports on a single network.
This commit is contained in:
Ben Nemec 2016-02-22 18:18:49 -06:00
parent 8f5ed82d79
commit cbf1d6a467
3 changed files with 25 additions and 16 deletions

View File

@ -63,10 +63,6 @@ Configuring the Host Cloud
happen with the baremetal instances booted from an empty image it speeds
things up a bit.
#. ``/etc/nova/nova.conf`` needs ``allow_duplicate_networks=true`` in the
``[neutron]`` section so that the BMC instance can have multiple nics on the
same network.
#. Restart ``nova-compute`` and ``neutron-openvswitch-agent`` to apply the
changes above.

View File

@ -12,14 +12,25 @@ $openstackbmc_script
EOF
chmod +x /usr/local/bin/openstackbmc
export OS_USERNAME=$os_user
export OS_TENANT_NAME=$os_tenant
export OS_PASSWORD=$os_password
export OS_AUTH_URL=$os_auth_url
private_subnet=$(neutron net-show -f value -c subnets $private_net)
default_gw=$(neutron subnet-show $private_subnet -f value -c gateway_ip)
prefix_len=$(neutron subnet-show -f value -c cidr $private_subnet | awk -F / '{print $2}')
mkdir /etc/os-net-config
echo "network_config:" > /etc/os-net-config/config.yaml
echo " -" >> /etc/os-net-config/config.yaml
echo " type: interface" >> /etc/os-net-config/config.yaml
echo " name: eth1" >> /etc/os-net-config/config.yaml
echo " name: eth0" >> /etc/os-net-config/config.yaml
echo " use_dhcp: false" >> /etc/os-net-config/config.yaml
echo " routes: []" >> /etc/os-net-config/config.yaml
echo " routes:" >> /etc/os-net-config/config.yaml
echo " - default: true" >> /etc/os-net-config/config.yaml
echo " next_hop: $default_gw" >> /etc/os-net-config/config.yaml
echo " addresses:" >> /etc/os-net-config/config.yaml
echo " - ip_netmask: $bmc_utility/$prefix_len" >> /etc/os-net-config/config.yaml
cat <<EOF >/usr/lib/systemd/system/config-bmc-ips.service
[Unit]
@ -38,14 +49,6 @@ StandardError=inherit
WantedBy=multi-user.target
EOF
export OS_USERNAME=$os_user
export OS_TENANT_NAME=$os_tenant
export OS_PASSWORD=$os_password
export OS_AUTH_URL=$os_auth_url
private_subnet=$(neutron net-show -f value -c subnets $private_net)
prefix_len=$(neutron subnet-show -f value -c cidr $private_subnet | awk -F / '{print $2}')
for i in $(seq 1 $bm_node_count)
do
bm_port="$bm_prefix_$(($i-1))"

View File

@ -124,6 +124,16 @@ resources:
port_range_min: 623
port_range_max: 623
bmc_port:
type: OS::Neutron::Port
properties:
name:
list_join:
- '_'
- - 'utility'
- {get_param: bmc_prefix}
network: {get_param: private_net}
bmc_server:
type: OS::Nova::Server
properties:
@ -131,8 +141,7 @@ resources:
image: {get_param: bmc_image}
key_name: {get_param: key_name}
networks:
- network: {get_param: private_net}
- network: {get_param: private_net}
- port: {get_resource: bmc_port}
name: {get_param: bmc_prefix}
user_data_format: RAW
user_data:
@ -144,6 +153,7 @@ resources:
$os_auth_url: {get_param: os_auth_url}
$bm_node_count: {get_param: node_count}
$bmc_prefix: {get_param: bmc_prefix}
$bmc_utility: {get_attr: [bmc_port, fixed_ips, 0, ip_address]}
$bm_prefix: {get_param: baremetal_prefix}
$private_net: {get_param: private_net}
$openstackbmc_script: {get_file: ../bin/openstackbmc}