Don't configure ip route for slaac ipv6 subnet

for the ipv6 subnet with ipv6_ra_mode is slaac or dhcpv6-stateless,
we don't need the configure the ip route for the nic in these
subnet. otherwise, docker daemon may returns error:
failed to set IPv6 gateway while updating gateway: file exists.
refer to: https://docs.openstack.org/neutron/latest/admin/config-ipv6.html

Change-Id: Id7f537039615479e03dcd546b7d738ca32f740db
This commit is contained in:
wu.chunyang 2023-12-08 15:18:15 +08:00
parent 895e59237e
commit 21b4cc2cf7
2 changed files with 12 additions and 1 deletions

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fix a bug where docker daemon occasionally returns error:
`failed to set IPv6 gateway while updating gateway: file exists: unknown`
when network_isolation is enabled.

View File

@ -583,11 +583,16 @@ class FreshInstanceTasks(FreshInstance, NotifyMixin, ConfigurationMixin):
nic_info["ipv4_cidr"] = subnet.get("cidr")
nic_info["ipv4_gateway"] = subnet.get("gateway_ip")
nic_info["ipv4_host_routes"] = subnet.get("host_routes")
# NOTE: only if the ipv6_ra_mode is dhcpv6-stateful,
# we need to configure the ip route for container. for slaac
# and dhcpv6-stateless mode, the route will be configured
# by the nic itself via the RA protocol.
elif subnet.get("ip_version") == 6:
nic_info["ipv6_address"] = fixed_ip.get("ip_address")
nic_info["ipv6_cidr"] = subnet.get("cidr")
nic_info["ipv6_gateway"] = subnet.get("gateway_ip")
nic_info["ipv6_host_routes"] = subnet.get("host_routes")
if subnet.get("ipv6_ra_mode") == "dhcpv6-stateful":
nic_info["ipv6_gateway"] = subnet.get("gateway_ip")
return nic_info
def create_instance(self, flavor, image_id, databases, users,