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
diff --git a/src/maasserver/preseed.py b/src/maasserver/preseed.py
index f2ed29c..6eadf99 100644
--- a/src/maasserver/preseed.py
+++ b/src/maasserver/preseed.py
@@ -457,7 +457,14 @@ def get_curtin_installer_url(node):
457 # Per etc/services cluster is opening port 5248 to serve images via HTTP457 # Per etc/services cluster is opening port 5248 to serve images via HTTP
458 image = get_curtin_image(node)458 image = get_curtin_image(node)
459 if image['xinstall_type'] == 'squashfs':459 if image['xinstall_type'] == 'squashfs':
460 return 'cp:///media/root-ro'460 # XXX: roaksoax LP: #1739761 - Since the switch to squashfs (and drop
461 # of iscsi), precise is no longer deployable. To address a squashfs
462 # image is made available allowing it to be deployed in the
463 # commissioning ephemeral environment.
464 if series == 'precise':
465 url_prepend = "fsimage:"
466 else:
467 return 'cp:///media/root-ro'
461 elif image['xinstall_type'] == 'tgz':468 elif image['xinstall_type'] == 'tgz':
462 url_prepend = ''469 url_prepend = ''
463 else:470 else:
diff --git a/src/maasserver/rpc/boot.py b/src/maasserver/rpc/boot.py
index e4c0acd..56bc51f 100644
--- a/src/maasserver/rpc/boot.py
+++ b/src/maasserver/rpc/boot.py
@@ -251,13 +251,19 @@ def get_config(
251251
252 # Get the correct operating system and series based on the purpose252 # Get the correct operating system and series based on the purpose
253 # of the booting machine.253 # of the booting machine.
254 precise = False
254 if purpose == "commissioning":255 if purpose == "commissioning":
255 osystem = Config.objects.get_config('commissioning_osystem')256 osystem = Config.objects.get_config('commissioning_osystem')
256 series = Config.objects.get_config('commissioning_distro_series')257 series = Config.objects.get_config('commissioning_distro_series')
257 else:258 else:
258 osystem = machine.get_osystem()259 osystem = machine.get_osystem()
259 series = machine.get_distro_series()260 series = machine.get_distro_series()
260 if purpose == "xinstall" and osystem != "ubuntu":261 # XXX: roaksoax LP: #1739761 - Since the switch to squashfs (and
262 # drop of iscsi), precise is no longer deployable. To address a
263 # squashfs image is made available allowing it to be deployed in
264 # the commissioning ephemeral environment.
265 precise = True if series == "precise" else False
266 if purpose == "xinstall" and (osystem != "ubuntu" or precise):
261 # Use only the commissioning osystem and series, for operating267 # Use only the commissioning osystem and series, for operating
262 # systems other than Ubuntu. As Ubuntu supports HWE kernels,268 # systems other than Ubuntu. As Ubuntu supports HWE kernels,
263 # and needs to use that kernel to perform the installation.269 # and needs to use that kernel to perform the installation.
@@ -273,7 +279,12 @@ def get_config(
273 # subarchitecture. Since Ubuntu does not support architecture specific279 # subarchitecture. Since Ubuntu does not support architecture specific
274 # hardware enablement kernels(i.e a highbank hwe-t kernel on precise)280 # hardware enablement kernels(i.e a highbank hwe-t kernel on precise)
275 # we give precedence to any kernel defined in the subarchitecture field281 # we give precedence to any kernel defined in the subarchitecture field
276 if subarch == "generic" and machine.hwe_kernel:282
283 # XXX: roaksoax LP: #1739761 - Do not override the subarch (used for
284 # the deployment ephemeral env) when deploying precise, provided that
285 # it uses the commissioning distro_series and hwe kernels are not
286 # needed.
287 if subarch == "generic" and machine.hwe_kernel and not precise:
277 subarch = machine.hwe_kernel288 subarch = machine.hwe_kernel
278 elif(subarch == "generic" and289 elif(subarch == "generic" and
279 purpose == "commissioning" and290 purpose == "commissioning" and
diff --git a/src/maasserver/rpc/tests/test_boot.py b/src/maasserver/rpc/tests/test_boot.py
index 84dfcf8..17898db 100644
--- a/src/maasserver/rpc/tests/test_boot.py
+++ b/src/maasserver/rpc/tests/test_boot.py
@@ -695,6 +695,27 @@ class TestGetConfig(MAASServerTestCase):
695 rack_controller.system_id, local_ip, remote_ip, mac=mac)695 rack_controller.system_id, local_ip, remote_ip, mac=mac)
696 self.assertEqual(distro_series, observed_config["release"])696 self.assertEqual(distro_series, observed_config["release"])
697697
698 # XXX: roaksoax LP: #1739761 - Deploying precise is now done using
699 # the commissioning ephemeral environment.
700 def test__returns_commissioning_os_series_for_precise_xinstall(self):
701 self.patch(boot_module, 'get_boot_filenames').return_value = (
702 None, None, None)
703 commissioning_series = "xenial"
704 Config.objects.set_config(
705 "commissioning_distro_series", commissioning_series)
706 distro_series = "precise"
707 rack_controller = factory.make_RackController()
708 local_ip = factory.make_ip_address()
709 remote_ip = factory.make_ip_address()
710 node = self.make_node(
711 status=NODE_STATUS.DEPLOYING, osystem='ubuntu',
712 distro_series=distro_series, primary_rack=rack_controller)
713 mac = node.get_boot_interface().mac_address
714 observed_config = get_config(
715 rack_controller.system_id, local_ip, remote_ip, mac=mac)
716 self.assertEqual(observed_config["release"], commissioning_series)
717 self.assertEqual(node.distro_series, distro_series)
718
698 def test__returns_commissioning_os_when_erasing_disks(self):719 def test__returns_commissioning_os_when_erasing_disks(self):
699 self.patch(boot_module, 'get_boot_filenames').return_value = (720 self.patch(boot_module, 'get_boot_filenames').return_value = (
700 None, None, None)721 None, None, None)
diff --git a/src/maasserver/tests/test_preseed.py b/src/maasserver/tests/test_preseed.py
index 6f5e7d6..76b5cc1 100644
--- a/src/maasserver/tests/test_preseed.py
+++ b/src/maasserver/tests/test_preseed.py
@@ -1577,6 +1577,36 @@ XJzKwRUEuJlIkVEZ72OtuoUMoBrjuADRlJQUW0ZbcmpOxjK1c6w08nhSvA==
1577 series, boot_image['label'], xinstall_path),1577 series, boot_image['label'], xinstall_path),
1578 installer_url)1578 installer_url)
15791579
1580 # XXX: roaksoax LP: #1739761 - Deploying precise is now done using
1581 # the commissioning ephemeral environment.
1582 def test_get_curtin_installer_url_returns_fsimage_precise_squashfs(self):
1583 osystem = make_usable_osystem(self)
1584 series = 'precise'
1585 architecture = make_usable_architecture(self)
1586 xinstall_path = factory.make_name('xi_path')
1587 xinstall_type = factory.make_name('xi_type')
1588 cluster_ip = factory.make_ipv4_address()
1589 node = factory.make_Node_with_Interface_on_Subnet(
1590 primary_rack=self.rpc_rack_controller, osystem=osystem['name'],
1591 architecture=architecture, distro_series=series,
1592 boot_cluster_ip=cluster_ip)
1593 arch, subarch = architecture.split('/')
1594 boot_image = make_rpc_boot_image(
1595 osystem=osystem['name'], release=series,
1596 architecture=arch, subarchitecture=subarch,
1597 purpose='xinstall', xinstall_path=xinstall_path,
1598 xinstall_type=xinstall_type)
1599 self.patch(
1600 preseed_module,
1601 'get_boot_images_for').return_value = [boot_image]
1602
1603 installer_url = get_curtin_installer_url(node)
1604 self.assertEqual(
1605 '%s:http://%s:5248/images/%s/%s/%s/%s/%s/%s' % (
1606 xinstall_type, cluster_ip, osystem['name'], arch, subarch,
1607 series, boot_image['label'], xinstall_path),
1608 installer_url)
1609
1580 def test_get_curtin_installer_url_returns_cp_for_squashfs(self):1610 def test_get_curtin_installer_url_returns_cp_for_squashfs(self):
1581 osystem = make_usable_osystem(self)1611 osystem = make_usable_osystem(self)
1582 series = osystem['default_release']1612 series = osystem['default_release']

Subscribers

People subscribed via source and target branches