With the implementation of dual-stack gateway support
as part of the Neutron multiple-ipv6-prefixes
blueprint, some of the code in the IPv6 setup in the
DevStack neutron legacy script must be removed. This
code had been added temporarily, with a TODO note
indicating that this code should be removed when
the Neutron L3 agent is modified to support
dual-stack.
Without this change, DevStack will fail to configure
the Neutron router gateway interface (there will be
no external connectivity) whenever IP_VERSION is set
to '4+6' in localrc/local.conf, since
first DevStack and later the Neutron L3 agent will be
trying to ADD the IPv6 address to the router gateway
interface.
This change also includes a modification of the
default prefix to be used for the public IPv6
subnet. The new value (2001:df8::/64) is a special
reserved prefix that will be treated as non-routable
external to the OpenStack instance.
Change-Id: I85fe68782bc54f28f3e14aa4a1d042cb15959dac
Partially-implements: blueprint multiple-ipv6-prefixes
| ... | ... |
@@ -57,9 +57,6 @@ |
| 57 | 57 |
# Settings |
| 58 | 58 |
# -------- |
| 59 | 59 |
|
| 60 |
-# Timeout value in seconds to wait for IPv6 gateway configuration |
|
| 61 |
-GATEWAY_TIMEOUT=30 |
|
| 62 |
- |
|
| 63 | 60 |
|
| 64 | 61 |
# Neutron Network Configuration |
| 65 | 62 |
# ----------------------------- |
| ... | ... |
@@ -90,12 +87,9 @@ IPV6_PUBLIC_SUBNET_NAME=${IPV6_PUBLIC_SUBNET_NAME:-ipv6-public-subnet}
|
| 90 | 90 |
IPV6_PRIVATE_SUBNET_NAME=${IPV6_PRIVATE_SUBNET_NAME:-ipv6-private-subnet}
|
| 91 | 91 |
FIXED_RANGE_V6=${FIXED_RANGE_V6:-fd$IPV6_GLOBAL_ID::/64}
|
| 92 | 92 |
IPV6_PRIVATE_NETWORK_GATEWAY=${IPV6_PRIVATE_NETWORK_GATEWAY:-fd$IPV6_GLOBAL_ID::1}
|
| 93 |
-IPV6_PUBLIC_RANGE=${IPV6_PUBLIC_RANGE:-fe80:cafe:cafe::/64}
|
|
| 94 |
-IPV6_PUBLIC_NETWORK_GATEWAY=${IPV6_PUBLIC_NETWORK_GATEWAY:-fe80:cafe:cafe::2}
|
|
| 95 |
-# IPV6_ROUTER_GW_IP must be defined when IP_VERSION=4+6 as it cannot be |
|
| 96 |
-# obtained conventionally until the l3-agent has support for dual-stack |
|
| 97 |
-# TODO (john-davidge) Remove once l3-agent supports dual-stack |
|
| 98 |
-IPV6_ROUTER_GW_IP=${IPV6_ROUTER_GW_IP:-fe80:cafe:cafe::1}
|
|
| 93 |
+IPV6_PUBLIC_RANGE=${IPV6_PUBLIC_RANGE:-2001:db8::/64}
|
|
| 94 |
+IPV6_PUBLIC_NETWORK_GATEWAY=${IPV6_PUBLIC_NETWORK_GATEWAY:-2001:db8::2}
|
|
| 95 |
+IPV6_ROUTER_GW_IP=${IPV6_ROUTER_GW_IP:-2001:db8::1}
|
|
| 99 | 96 |
|
| 100 | 97 |
# Set up default directories |
| 101 | 98 |
GITDIR["python-neutronclient"]=$DEST/python-neutronclient |
| ... | ... |
@@ -1291,20 +1285,12 @@ function _neutron_configure_router_v6 {
|
| 1291 | 1291 |
|
| 1292 | 1292 |
# This logic is specific to using the l3-agent for layer 3 |
| 1293 | 1293 |
if is_service_enabled q-l3; then |
| 1294 |
- local ipv6_router_gw_port |
|
| 1295 | 1294 |
# Ensure IPv6 forwarding is enabled on the host |
| 1296 | 1295 |
sudo sysctl -w net.ipv6.conf.all.forwarding=1 |
| 1297 | 1296 |
# Configure and enable public bridge |
| 1298 |
- if [[ "$IP_VERSION" = "6" ]]; then |
|
| 1299 |
- # Override global IPV6_ROUTER_GW_IP with the true value from neutron |
|
| 1300 |
- IPV6_ROUTER_GW_IP=`neutron port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' -v subnet_id=$ipv6_pub_subnet_id '$4 == subnet_id { print $8; }'`
|
|
| 1301 |
- die_if_not_set $LINENO IPV6_ROUTER_GW_IP "Failure retrieving IPV6_ROUTER_GW_IP" |
|
| 1302 |
- ipv6_router_gw_port=`neutron port-list -c id -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' -v subnet_id=$ipv6_pub_subnet_id '$4 == subnet_id { print $1; }' | awk -F ' | ' '{ print $2; }'`
|
|
| 1303 |
- die_if_not_set $LINENO ipv6_router_gw_port "Failure retrieving ipv6_router_gw_port" |
|
| 1304 |
- else |
|
| 1305 |
- ipv6_router_gw_port=`neutron port-list -c id -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' -v subnet_id=$PUB_SUBNET_ID '$4 == subnet_id { print $1; }' | awk -F ' | ' '{ print $2; }'`
|
|
| 1306 |
- die_if_not_set $LINENO ipv6_router_gw_port "Failure retrieving ipv6_router_gw_port" |
|
| 1307 |
- fi |
|
| 1297 |
+ # Override global IPV6_ROUTER_GW_IP with the true value from neutron |
|
| 1298 |
+ IPV6_ROUTER_GW_IP=`neutron port-list -c fixed_ips | grep $ipv6_pub_subnet_id | awk -F '"' -v subnet_id=$ipv6_pub_subnet_id '$4 == subnet_id { print $8; }'`
|
|
| 1299 |
+ die_if_not_set $LINENO IPV6_ROUTER_GW_IP "Failure retrieving IPV6_ROUTER_GW_IP" |
|
| 1308 | 1300 |
|
| 1309 | 1301 |
# The ovs_base_configure_l3_agent function flushes the public |
| 1310 | 1302 |
# bridge's ip addresses, so turn IPv6 support in the host off |
| ... | ... |
@@ -1321,28 +1307,8 @@ function _neutron_configure_router_v6 {
|
| 1321 | 1321 |
local ext_gw_interface=$(_neutron_get_ext_gw_interface) |
| 1322 | 1322 |
local ipv6_cidr_len=${IPV6_PUBLIC_RANGE#*/}
|
| 1323 | 1323 |
|
| 1324 |
- # Define router_ns based on whether DVR is enabled |
|
| 1325 |
- local router_ns=qrouter |
|
| 1326 |
- if [[ "$Q_DVR_MODE" == "dvr_snat" ]]; then |
|
| 1327 |
- router_ns=snat |
|
| 1328 |
- fi |
|
| 1329 |
- |
|
| 1330 | 1324 |
# Configure interface for public bridge |
| 1331 | 1325 |
sudo ip -6 addr add $ipv6_ext_gw_ip/$ipv6_cidr_len dev $ext_gw_interface |
| 1332 |
- |
|
| 1333 |
- # Wait until layer 3 agent has configured the gateway port on |
|
| 1334 |
- # the public bridge, then add gateway address to the interface |
|
| 1335 |
- # TODO (john-davidge) Remove once l3-agent supports dual-stack |
|
| 1336 |
- if [[ "$IP_VERSION" == "4+6" ]]; then |
|
| 1337 |
- if ! timeout $GATEWAY_TIMEOUT sh -c "until sudo ip netns exec $router_ns-$ROUTER_ID ip addr show qg-${ipv6_router_gw_port:0:11} | grep $ROUTER_GW_IP; do sleep 1; done"; then
|
|
| 1338 |
- die $LINENO "Timeout retrieving ROUTER_GW_IP" |
|
| 1339 |
- fi |
|
| 1340 |
- # Configure the gateway port with the public IPv6 adress |
|
| 1341 |
- sudo ip netns exec $router_ns-$ROUTER_ID ip -6 addr add $IPV6_ROUTER_GW_IP/$ipv6_cidr_len dev qg-${ipv6_router_gw_port:0:11}
|
|
| 1342 |
- # Add a default IPv6 route to the neutron router as the |
|
| 1343 |
- # l3-agent does not add one in the dual-stack case |
|
| 1344 |
- sudo ip netns exec $router_ns-$ROUTER_ID ip -6 route replace default via $ipv6_ext_gw_ip dev qg-${ipv6_router_gw_port:0:11}
|
|
| 1345 |
- fi |
|
| 1346 | 1326 |
sudo ip -6 route add $FIXED_RANGE_V6 via $IPV6_ROUTER_GW_IP dev $ext_gw_interface |
| 1347 | 1327 |
fi |
| 1348 | 1328 |
_neutron_set_router_id |