From 1df0ad3c6ddf2248461d5eb465db096b2204b079 Mon Sep 17 00:00:00 2001 From: Scott Hussey Date: Mon, 26 Feb 2018 20:47:57 -0600 Subject: [PATCH] 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 --- images/maas-region-controller/2.3_route.patch | 28 +++++++++++++++++++ images/maas-region-controller/Dockerfile | 2 ++ 2 files changed, 30 insertions(+) create mode 100644 images/maas-region-controller/2.3_route.patch diff --git a/images/maas-region-controller/2.3_route.patch b/images/maas-region-controller/2.3_route.patch new file mode 100644 index 0000000..46bc9cc --- /dev/null +++ b/images/maas-region-controller/2.3_route.patch @@ -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} diff --git a/images/maas-region-controller/Dockerfile b/images/maas-region-controller/Dockerfile index dceac0b..e6efcd9 100644 --- a/images/maas-region-controller/Dockerfile +++ b/images/maas-region-controller/Dockerfile @@ -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"]