From 56521ab77c746b8e7de129160f8859e31bee9a3a Mon Sep 17 00:00:00 2001 From: "Crank, Daniel (dc6350)" Date: Thu, 11 Oct 2018 09:03:46 -0500 Subject: [PATCH] [470918] Update MaaS to 2.3.5 Updating MaaS to 2.3.5, as 2.3.0 appears to no longer be available in the Ubuntu repo. Change-Id: I5afb38d8e73485be1ab05a9ac2a18e1befe70152 --- .../maas-rack-controller/2.3_nic_filter.patch | 4 +- images/maas-rack-controller/Dockerfile | 3 +- .../maas-region-controller/2.3_nat_fix.patch | 18 ------ .../2.3_proxy_port.patch | 20 +++--- .../2.3_recursion_fix.patch | 63 ------------------- images/maas-region-controller/2.3_route.patch | 21 +------ images/maas-region-controller/Dockerfile | 6 +- 7 files changed, 19 insertions(+), 116 deletions(-) delete mode 100644 images/maas-region-controller/2.3_nat_fix.patch delete mode 100644 images/maas-region-controller/2.3_recursion_fix.patch diff --git a/images/maas-rack-controller/2.3_nic_filter.patch b/images/maas-rack-controller/2.3_nic_filter.patch index 23ca783..cd6e710 100644 --- a/images/maas-rack-controller/2.3_nic_filter.patch +++ b/images/maas-rack-controller/2.3_nic_filter.patch @@ -1,8 +1,8 @@ diff --git a/src/provisioningserver/utils/network.py b/src/provisioningserver/utils/network.py -index 48eb8fd..41d13a0 100644 +index 960d3eb..cd627fd 100644 --- a/src/provisioningserver/utils/network.py +++ b/src/provisioningserver/utils/network.py -@@ -1141,7 +1141,7 @@ def get_all_interfaces_definition(annotate_with_monitored: bool=True) -> dict: +@@ -1138,7 +1138,7 @@ def get_all_interfaces_definition(annotate_with_monitored: bool=True) -> dict: interfaces = {} dhclient_info = get_dhclient_info() iproute_info = get_ip_route() diff --git a/images/maas-rack-controller/Dockerfile b/images/maas-rack-controller/Dockerfile index c808df4..0b9b7f4 100644 --- a/images/maas-rack-controller/Dockerfile +++ b/images/maas-rack-controller/Dockerfile @@ -29,7 +29,7 @@ RUN systemctl set-default multi-user.target RUN apt-get install -y rsyslog RUN systemctl enable rsyslog.service -ENV MAAS_VERSION 2.3.0-6434-gd354690-0ubuntu1~16.04.1 +ENV MAAS_VERSION 2.3.5-6511-gf466fdb-0ubuntu1 # install maas RUN rsyslogd; apt-get install -y maas-cli=$MAAS_VERSION maas-rack-controller=$MAAS_VERSION @@ -45,6 +45,7 @@ RUN mv /usr/sbin/tcpdump /usr/bin/tcpdump RUN ln -s /usr/bin/tcpdump /usr/sbin/tcpdump # Patch so that Calico interfaces are ignored +# dc6350: this appears to be fixed in maas master as of 10/4/2018, but that change is not in 2.3.5 COPY 2.3_nic_filter.patch /tmp/2.3_nic_filter.patch RUN cd /usr/lib/python3/dist-packages/provisioningserver/utils && patch network.py < /tmp/2.3_nic_filter.patch diff --git a/images/maas-region-controller/2.3_nat_fix.patch b/images/maas-region-controller/2.3_nat_fix.patch deleted file mode 100644 index b07d48c..0000000 --- a/images/maas-region-controller/2.3_nat_fix.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/src/maasserver/utils/__init__.py b/src/maasserver/utils/__init__.py -index 1c58859..f8e673d 100644 ---- a/src/maasserver/utils/__init__.py -+++ b/src/maasserver/utils/__init__.py -@@ -66,8 +66,11 @@ def absolute_reverse( - if not base_url: - with RegionConfiguration.open() as config: - base_url = config.maas_url -- if default_region_ip is not None: -- base_url = compose_URL(base_url, default_region_ip) -+ # NOTE(sh8121att) -+ # Commenting out as workaround to -+ # https://bugs.launchpad.net/maas/+bug/1743005 -+ #if default_region_ip is not None: -+ # base_url = compose_URL(base_url, default_region_ip) - url = urljoin(base_url, reverse(view_name, *args, **kwargs)) - if query is not None: - url += '?%s' % urlencode(query, doseq=True) diff --git a/images/maas-region-controller/2.3_proxy_port.patch b/images/maas-region-controller/2.3_proxy_port.patch index b28e95f..89f98b7 100644 --- a/images/maas-region-controller/2.3_proxy_port.patch +++ b/images/maas-region-controller/2.3_proxy_port.patch @@ -1,14 +1,14 @@ diff --git a/src/maasserver/compose_preseed.py b/src/maasserver/compose_preseed.py -index e15b3b2..b7c7edc 100644 +index f24b10f..f030469 100644 --- a/src/maasserver/compose_preseed.py +++ b/src/maasserver/compose_preseed.py @@ -8,7 +8,7 @@ __all__ = [ ] - + from datetime import timedelta -from urllib.parse import urlencode +from urllib.parse import urlencode, urlparse - + from maasserver.clusterrpc.osystems import get_preseed_data from maasserver.enum import ( @@ -17,6 +17,7 @@ from maasserver.enum import ( @@ -19,16 +19,18 @@ index e15b3b2..b7c7edc 100644 from maasserver.models.config import Config from maasserver.server_address import get_maas_facing_server_host from maasserver.utils import absolute_reverse -@@ -41,9 +42,9 @@ def get_apt_proxy(rack_controller=None, default_region_ip=None): - if http_proxy and not use_peer_proxy: - return http_proxy +@@ -43,11 +44,11 @@ def get_apt_proxy(rack_controller=None, default_region_ip=None): else: + maas_proxy_port = Config.objects.get_config("maas_proxy_port") + if not maas_proxy_port: +- maas_proxy_port = 8000 ++ maas_proxy_port = 31800 + url = "http://:%d/" % maas_proxy_port - return compose_URL( -- "http://:8000/", get_maas_facing_server_host( +- url, get_maas_facing_server_host( - rack_controller, default_region_ip=default_region_ip)) + with RegionConfiguration.open() as config: + maas_url = config.maas_url -+ return compose_URL("http://:31800/", urlparse(maas_url).hostname) ++ return compose_URL(url, urlparse(maas_url).hostname) else: return None - diff --git a/images/maas-region-controller/2.3_recursion_fix.patch b/images/maas-region-controller/2.3_recursion_fix.patch deleted file mode 100644 index d7ab647..0000000 --- a/images/maas-region-controller/2.3_recursion_fix.patch +++ /dev/null @@ -1,63 +0,0 @@ -=== modified file 'src/maasserver/models/signals/interfaces.py' ---- src/maasserver/models/signals/interfaces.py 2016-07-30 01:17:54 +0000 -+++ src/maasserver/models/signals/interfaces.py 2016-09-10 07:09:35 +0000 -@@ -45,6 +45,28 @@ - signals = SignalsManager() - - -+class InterfaceVisitingThreadLocal(threading.local): -+ """Since infinite recursion could occur in an arbitrary interface -+ hierarchy, use thread-local storage to ensure that each interface is only -+ visited once. -+ """ -+ def __init__(self): -+ super().__init__() -+ self.visiting = set() -+ -+enabled_or_disabled_thread_local = InterfaceVisitingThreadLocal() -+ -+ -+def ensure_link_up(interface): -+ visiting = enabled_or_disabled_thread_local.visiting -+ if interface.id not in visiting: -+ try: -+ visiting.add(interface.id) -+ interface.ensure_link_up() -+ finally: -+ visiting.discard(interface.id) -+ -+ - def interface_enabled_or_disabled(instance, old_values, **kwargs): - """When an interface is enabled be sure at minimum a LINK_UP is created. - When an interface is disabled make sure that all its links are removed, -@@ -53,9 +75,10 @@ - return - if instance.is_enabled(): - # Make sure it has a LINK_UP link, and for its children. -- instance.ensure_link_up() -+ ensure_link_up(instance) - for rel in instance.children_relationships.all(): -- rel.child.ensure_link_up() -+ ensure_link_up(rel.child) -+ - else: - # Was disabled. Remove the links. - for ip_address in instance.ip_addresses.exclude( -@@ -140,16 +163,7 @@ - klass, ['params'], delete=False) - - --class InterfaceUpdateParentsThreadLocal(threading.local): -- """Since infinite recursion could occur in an arbitrary interface -- hierarchy, use thread-local stroage to ensure that each interface is only -- visited once. -- """ -- def __init__(self): -- super().__init__() -- self.visiting = set() -- --update_parents_thread_local = InterfaceUpdateParentsThreadLocal() -+update_parents_thread_local = InterfaceVisitingThreadLocal() - - - def update_interface_parents(sender, instance, created, **kwargs): diff --git a/images/maas-region-controller/2.3_route.patch b/images/maas-region-controller/2.3_route.patch index 46bc9cc..f5e9765 100644 --- a/images/maas-region-controller/2.3_route.patch +++ b/images/maas-region-controller/2.3_route.patch @@ -1,28 +1,13 @@ diff --git a/src/maasserver/preseed_network.py b/src/maasserver/preseed_network.py -index 1be72d6..96ee6a3 100644 +index bb56765..1185ff1 100644 --- a/src/maasserver/preseed_network.py +++ b/src/maasserver/preseed_network.py -@@ -192,7 +192,7 @@ class InterfaceConfiguration: +@@ -203,7 +203,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 4e99704..ca9e078 100644 --- a/images/maas-region-controller/Dockerfile +++ b/images/maas-region-controller/Dockerfile @@ -30,7 +30,7 @@ RUN apt-get install -y systemd RUN apt-get install -y rsyslog RUN systemctl enable rsyslog.service -ENV MAAS_VERSION 2.3.0-6434-gd354690-0ubuntu1~16.04.1 +ENV MAAS_VERSION 2.3.5-6511-gf466fdb-0ubuntu1 # install maas RUN rsyslogd; apt-get install -y maas-cli=$MAAS_VERSION \ @@ -54,14 +54,10 @@ RUN apt-get download maas-region-controller=$MAAS_VERSION && \ pg_dropcluster --stop 9.5 main # 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 -COPY 2.3_recursion_fix.patch /tmp/2.3_recursion_fix.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 -RUN cd /usr/lib/python3/dist-packages/maasserver/models/signals && patch interfaces.py < /tmp/2.3_recursion_fix.patch COPY journalctl-to-tty.service /etc/systemd/system/journalctl-to-tty.service RUN mkdir -p /etc/systemd/system/basic.target.wants ;\