openstack-ansible-os_neutron/files/post-up-metadata-checksum
Jesse Pretorius e572680292 Add metadata checksum fix for AIO-type networks configs
When running in an AIO, we need to implement an iptables rule in any
neutron_agent containers to that ensure instances can communicate with
the neutron metadata service. This is necessary because in an AIO
environment there are no physical interfaces involved in instance ->
metadata requests, and this results in the checksums being incorrect.

This is a necessary patch in order to work towards getting rid of the
run-playbooks.sh script in the integrated repository. With this patch
in place we will be able to set the AIO to activate this code path by
setting 'neutron_metadata_checksum_fix: True' in the AIO's
user_variables.yml, forgoing the needs to implement this in a bash
script.

Change-Id: I008bfdb2960800845703e721b38640b7434d1404
2016-06-07 16:56:07 +01:00

38 lines
1.6 KiB
Bash

#!/usr/bin/env bash
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTICE:
# When running in an AIO, we need to drop the following iptables rule in any
# neutron_agent containers to that ensure instances can communicate with the
# neutron metadata service. This is necessary because in an AIO environment
# there are no physical interfaces involved in instance -> metadata requests,
# and this results in the checksums being incorrect.
# Iptables path, used for ipv4 firewall.
IPTABLES=$(which iptables)
if [ ! -z "${IPTABLES}" ]; then
if ! ${IPTABLES} -C POSTROUTING -t mangle -p tcp --sport 80 -j CHECKSUM --checksum-fill 2> /dev/null; then
${IPTABLES} -A POSTROUTING -t mangle -p tcp --sport 80 -j CHECKSUM --checksum-fill
fi
fi
# Ip6tables path, used for ipv6 firewall.
IP6TABLES=$(which ip6tables)
if [ ! -z "${IP6TABLES}" ]; then
if ! ${IP6TABLES} -C POSTROUTING -t mangle -p udp --sport 80 -j CHECKSUM --checksum-fill 2> /dev/null; then
${IP6TABLES} -A POSTROUTING -t mangle -p udp --sport 80 -j CHECKSUM --checksum-fill
fi
fi