Merge ~andreserl/maas:deploy_precise_squashfs into maas:master

Proposed by Andres Rodriguez
Status: Merged
Approved by: Andres Rodriguez
Approved revision: d384623ac8e4a86b3a4b5d8d5c5f22a60fc4d3b8
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~andreserl/maas:deploy_precise_squashfs
Merge into: maas:master
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
MAAS Lander Needs Fixing
Lee Trager (community) Approve
Review via email: mp+337107@code.launchpad.net

Commit message

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

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

UNIT TESTS
-b deploy_precise_squashfs lp:~andreserl/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci-jenkins.internal:8080/job/maas/job/branch-tester/1410/console
COMMIT: 10051e55f7927e6548bc0b8141d8b6e3c9b9e2b3

review: Needs Fixing
Revision history for this message
Lee Trager (ltrager) wrote :

This tries to use the latest commissioning OS with the kernel being deployed. hwe-p isn't available with Trusty+ so this fails to boot.

review: Needs Fixing
Revision history for this message
Lee Trager (ltrager) wrote :

This branch fixes the kernel issue, it also tries to use the dd-gz image for deployment if available.

https://code.launchpad.net/~ltrager/maas/+git/maas/+merge/337110

Revision history for this message
Scott Moser (smoser) wrote :

Onto this branch, please add
diff --git a/src/maasserver/preseed.py b/src/maasserver/preseed.py
index 5d224f893..7b9e1663b 100644
--- a/src/maasserver/preseed.py
+++ b/src/maasserver/preseed.py
@@ -460,6 +460,8 @@ def get_curtin_installer_url(node):
         return 'cp:///media/root-ro'
     elif image['xinstall_type'] == 'tgz':
         url_prepend = ''
+ elif image['xinstall_type'] == 'squashfs':
+ url_prepend = 'fsimage:'
     else:
         url_prepend = '%s:' % image['xinstall_type']
     dyn_uri = '/'.join([

This way, you'll tell curtin that this url is a 'fsimage'.
rather than a 'squashfs' type.

Revision history for this message
Lee Trager (ltrager) wrote :

LGTM!

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b deploy_precise_squashfs lp:~andreserl/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci-jenkins.internal:8080/job/maas/job/branch-tester/1478/console
COMMIT: d89465d7ac1b1efefcc9edc393539057d4f9792b

review: Needs Fixing
Revision history for this message
MAAS Lander (maas-lander) wrote :
Revision history for this message
MAAS Lander (maas-lander) wrote :
Revision history for this message
MAAS Lander (maas-lander) wrote :
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b deploy_precise_squashfs lp:~andreserl/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci-jenkins.internal:8080/job/maas/job/branch-tester/1503/console
COMMIT: 6c1660065c96fc5cfea971aa13c64ea538512256

review: Needs Fixing
Revision history for this message
MAAS Lander (maas-lander) wrote :
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b deploy_precise_squashfs lp:~andreserl/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci-jenkins.internal:8080/job/maas/job/branch-tester/1507/console
COMMIT: 4b81730a80ffe50990655ec26d11f59936826003

review: Needs Fixing
d384623... by Andres Rodriguez

Fix lint

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 3dbad53..85b63f8 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