From cbf1d6a467b35467345d4b33510e212271a0c7a0 Mon Sep 17 00:00:00 2001 From: Ben Nemec Date: Mon, 22 Feb 2016 18:18:49 -0600 Subject: [PATCH] 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. --- README.rst | 4 ---- bin/install_openstackbmc.sh | 23 +++++++++++++---------- templates/virtual-baremetal.yaml | 14 ++++++++++++-- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/README.rst b/README.rst index 3aa249e..88696c4 100644 --- a/README.rst +++ b/README.rst @@ -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. diff --git a/bin/install_openstackbmc.sh b/bin/install_openstackbmc.sh index e8e935e..369d9a0 100644 --- a/bin/install_openstackbmc.sh +++ b/bin/install_openstackbmc.sh @@ -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 </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))" diff --git a/templates/virtual-baremetal.yaml b/templates/virtual-baremetal.yaml index 0239350..b341b67 100644 --- a/templates/virtual-baremetal.yaml +++ b/templates/virtual-baremetal.yaml @@ -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}