Fix for unconfigured static routes

- Hot-patch MaaS code so that the cloud-init
  network configuration YAML places static routes
  within the interface configuration that is the
  source network for the route. this should fix route
  volatility on deployment caused by the default behavior
  of all static routes going to the bottom of the network
  configuration and thus being attached to the last interface
  defined

Change-Id: Ibe04000dafc21b37386777968c43e1b34e1a9838
This commit is contained in:
Scott Hussey 2018-02-26 20:47:57 -06:00
parent bde0e4260e
commit 1df0ad3c6d
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,28 @@
diff --git a/src/maasserver/preseed_network.py b/src/maasserver/preseed_network.py
index 1be72d6..96ee6a3 100644
--- a/src/maasserver/preseed_network.py
+++ b/src/maasserver/preseed_network.py
@@ -192,7 +192,7 @@ class InterfaceConfiguration:
return {
route
for route in self.routes
- if route.source == source
+ if str(route.source.cidr) == str(source.cidr)
}
def _generate_addresses(self, version=1):
@@ -251,8 +251,12 @@ class InterfaceConfiguration:
v2_nameservers["addresses"] = []
v2_nameservers["addresses"].extend(
[server for server in subnet.dns_servers])
- self.matching_routes.update(
- self._get_matching_routes(subnet))
+ net_routes = self._get_matching_routes(subnet)
+ rl = [_generate_route_operation(r, version=version)
+ for r
+ in net_routes]
+ v1_subnet_operation['routes'] = rl
+ v2_config['routes'] = rl
if dhcp_type:
v1_config.append(
{"type": dhcp_type}

View File

@ -53,8 +53,10 @@ RUN apt-get download maas-region-controller=$MAAS_VERSION && \
# 2.3 workarounds
COPY 2.3_nat_fix.patch /tmp/2.3_nat_fix.patch
COPY 2.3_proxy_port.patch /tmp/2.3_proxy_port.patch
COPY 2.3_route.patch /tmp/2.3_route.patch
RUN cd /usr/lib/python3/dist-packages/maasserver/utils && patch __init__.py < /tmp/2.3_nat_fix.patch
RUN cd /usr/lib/python3/dist-packages/maasserver && patch compose_preseed.py < /tmp/2.3_proxy_port.patch
RUN cd /usr/lib/python3/dist-packages/maasserver && patch preseed_network.py < /tmp/2.3_route.patch
# initalize systemd
CMD ["/sbin/init"]