Merge ~andreserl/maas:2.3_deploy_precise_squashfs into maas:2.3

Proposed by Andres Rodriguez
Status: Merged
Approved by: Andres Rodriguez
Approved revision: f8e1d8dad9245fafa712c7c3e6c9cbeb98df8c50
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~andreserl/maas:2.3_deploy_precise_squashfs
Merge into: maas:2.3
Diff against target: 132 lines (+72/-3)
4 files modified
src/maasserver/preseed.py (+8/-1)
src/maasserver/rpc/boot.py (+13/-2)
src/maasserver/rpc/tests/test_boot.py (+21/-0)
src/maasserver/tests/test_preseed.py (+30/-0)
Reviewer Review Type Date Requested Status
Alberto Donato (community) Approve
MAAS Lander Approve
Review via email: mp+337817@code.launchpad.net

Commit message

LP: #1739761 - Add the ability to deploy a precise squashfs image.

Backport 88854aa35e1f10bff67dc9478eb4a34cb2005f99 from master.

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b 2.3_deploy_precise_squashfs lp:~andreserl/maas/+git/maas into -b 2.3 lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: f8e1d8dad9245fafa712c7c3e6c9cbeb98df8c50

review: Approve
Revision history for this message
Alberto Donato (ack) wrote :

+1 Small nit inline

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/preseed.py b/src/maasserver/preseed.py
2index f2ed29c..6eadf99 100644
3--- a/src/maasserver/preseed.py
4+++ b/src/maasserver/preseed.py
5@@ -457,7 +457,14 @@ def get_curtin_installer_url(node):
6 # Per etc/services cluster is opening port 5248 to serve images via HTTP
7 image = get_curtin_image(node)
8 if image['xinstall_type'] == 'squashfs':
9- return 'cp:///media/root-ro'
10+ # XXX: roaksoax LP: #1739761 - Since the switch to squashfs (and drop
11+ # of iscsi), precise is no longer deployable. To address a squashfs
12+ # image is made available allowing it to be deployed in the
13+ # commissioning ephemeral environment.
14+ if series == 'precise':
15+ url_prepend = "fsimage:"
16+ else:
17+ return 'cp:///media/root-ro'
18 elif image['xinstall_type'] == 'tgz':
19 url_prepend = ''
20 else:
21diff --git a/src/maasserver/rpc/boot.py b/src/maasserver/rpc/boot.py
22index e4c0acd..56bc51f 100644
23--- a/src/maasserver/rpc/boot.py
24+++ b/src/maasserver/rpc/boot.py
25@@ -251,13 +251,19 @@ def get_config(
26
27 # Get the correct operating system and series based on the purpose
28 # of the booting machine.
29+ precise = False
30 if purpose == "commissioning":
31 osystem = Config.objects.get_config('commissioning_osystem')
32 series = Config.objects.get_config('commissioning_distro_series')
33 else:
34 osystem = machine.get_osystem()
35 series = machine.get_distro_series()
36- if purpose == "xinstall" and osystem != "ubuntu":
37+ # XXX: roaksoax LP: #1739761 - Since the switch to squashfs (and
38+ # drop of iscsi), precise is no longer deployable. To address a
39+ # squashfs image is made available allowing it to be deployed in
40+ # the commissioning ephemeral environment.
41+ precise = True if series == "precise" else False
42+ if purpose == "xinstall" and (osystem != "ubuntu" or precise):
43 # Use only the commissioning osystem and series, for operating
44 # systems other than Ubuntu. As Ubuntu supports HWE kernels,
45 # and needs to use that kernel to perform the installation.
46@@ -273,7 +279,12 @@ def get_config(
47 # subarchitecture. Since Ubuntu does not support architecture specific
48 # hardware enablement kernels(i.e a highbank hwe-t kernel on precise)
49 # we give precedence to any kernel defined in the subarchitecture field
50- if subarch == "generic" and machine.hwe_kernel:
51+
52+ # XXX: roaksoax LP: #1739761 - Do not override the subarch (used for
53+ # the deployment ephemeral env) when deploying precise, provided that
54+ # it uses the commissioning distro_series and hwe kernels are not
55+ # needed.
56+ if subarch == "generic" and machine.hwe_kernel and not precise:
57 subarch = machine.hwe_kernel
58 elif(subarch == "generic" and
59 purpose == "commissioning" and
60diff --git a/src/maasserver/rpc/tests/test_boot.py b/src/maasserver/rpc/tests/test_boot.py
61index 84dfcf8..17898db 100644
62--- a/src/maasserver/rpc/tests/test_boot.py
63+++ b/src/maasserver/rpc/tests/test_boot.py
64@@ -695,6 +695,27 @@ class TestGetConfig(MAASServerTestCase):
65 rack_controller.system_id, local_ip, remote_ip, mac=mac)
66 self.assertEqual(distro_series, observed_config["release"])
67
68+ # XXX: roaksoax LP: #1739761 - Deploying precise is now done using
69+ # the commissioning ephemeral environment.
70+ def test__returns_commissioning_os_series_for_precise_xinstall(self):
71+ self.patch(boot_module, 'get_boot_filenames').return_value = (
72+ None, None, None)
73+ commissioning_series = "xenial"
74+ Config.objects.set_config(
75+ "commissioning_distro_series", commissioning_series)
76+ distro_series = "precise"
77+ rack_controller = factory.make_RackController()
78+ local_ip = factory.make_ip_address()
79+ remote_ip = factory.make_ip_address()
80+ node = self.make_node(
81+ status=NODE_STATUS.DEPLOYING, osystem='ubuntu',
82+ distro_series=distro_series, primary_rack=rack_controller)
83+ mac = node.get_boot_interface().mac_address
84+ observed_config = get_config(
85+ rack_controller.system_id, local_ip, remote_ip, mac=mac)
86+ self.assertEqual(observed_config["release"], commissioning_series)
87+ self.assertEqual(node.distro_series, distro_series)
88+
89 def test__returns_commissioning_os_when_erasing_disks(self):
90 self.patch(boot_module, 'get_boot_filenames').return_value = (
91 None, None, None)
92diff --git a/src/maasserver/tests/test_preseed.py b/src/maasserver/tests/test_preseed.py
93index 6f5e7d6..76b5cc1 100644
94--- a/src/maasserver/tests/test_preseed.py
95+++ b/src/maasserver/tests/test_preseed.py
96@@ -1577,6 +1577,36 @@ XJzKwRUEuJlIkVEZ72OtuoUMoBrjuADRlJQUW0ZbcmpOxjK1c6w08nhSvA==
97 series, boot_image['label'], xinstall_path),
98 installer_url)
99
100+ # XXX: roaksoax LP: #1739761 - Deploying precise is now done using
101+ # the commissioning ephemeral environment.
102+ def test_get_curtin_installer_url_returns_fsimage_precise_squashfs(self):
103+ osystem = make_usable_osystem(self)
104+ series = 'precise'
105+ architecture = make_usable_architecture(self)
106+ xinstall_path = factory.make_name('xi_path')
107+ xinstall_type = factory.make_name('xi_type')
108+ cluster_ip = factory.make_ipv4_address()
109+ node = factory.make_Node_with_Interface_on_Subnet(
110+ primary_rack=self.rpc_rack_controller, osystem=osystem['name'],
111+ architecture=architecture, distro_series=series,
112+ boot_cluster_ip=cluster_ip)
113+ arch, subarch = architecture.split('/')
114+ boot_image = make_rpc_boot_image(
115+ osystem=osystem['name'], release=series,
116+ architecture=arch, subarchitecture=subarch,
117+ purpose='xinstall', xinstall_path=xinstall_path,
118+ xinstall_type=xinstall_type)
119+ self.patch(
120+ preseed_module,
121+ 'get_boot_images_for').return_value = [boot_image]
122+
123+ installer_url = get_curtin_installer_url(node)
124+ self.assertEqual(
125+ '%s:http://%s:5248/images/%s/%s/%s/%s/%s/%s' % (
126+ xinstall_type, cluster_ip, osystem['name'], arch, subarch,
127+ series, boot_image['label'], xinstall_path),
128+ installer_url)
129+
130 def test_get_curtin_installer_url_returns_cp_for_squashfs(self):
131 osystem = make_usable_osystem(self)
132 series = osystem['default_release']

Subscribers

People subscribed via source and target branches