Merge lp:~mpontillo/maas/custom-network-non-ubuntu-1570002 into lp:~maas-committers/maas/trunk

Proposed by Mike Pontillo
Status: Merged
Approved by: Mike Pontillo
Approved revision: no longer in the source branch.
Merged at revision: 5009
Proposed branch: lp:~mpontillo/maas/custom-network-non-ubuntu-1570002
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 64 lines (+18/-8)
2 files modified
src/maasserver/preseed.py (+3/-4)
src/maasserver/tests/test_preseed.py (+15/-4)
To merge this branch: bzr merge lp:~mpontillo/maas/custom-network-non-ubuntu-1570002
Reviewer Review Type Date Requested Status
Blake Rouse (community) Approve
Lee Trager (community) Approve
Review via email: mp+293579@code.launchpad.net

Commit message

Compose networking preseed for non-Ubuntu operating systems.

To post a comment you must log in.
Revision history for this message
Mike Pontillo (mpontillo) wrote :

I tested this with the latest CentOS 7 image, built using scripts provided to me by ltrager (to avoid a bug in the currently-provided images where the curtin hooks fail. (Now that the curtin hooks use Python 2 *or* Python 3, depending on what is available, everything seems to work.)

As expected, the curtin_hooks.py script does not do any interface configuration other than setting the boot interface to DHCP. But now that the data is being provided, it should be possible to change the script to interpret the data and configure the interfaces as-modeled-in-MAAS.

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

LGTM!

As for the next step I'd prefer to modify curtin to have generic Linux support. This would make deploying any Linux image much easier in MAAS. We also wouldn't have to maintain a different curtin hook for each Linux image which has to work with all versions of curtin.

review: Approve
Revision history for this message
Blake Rouse (blake-rouse) wrote :

Looks good. Glad you have tested this with CentOS and have not ran into any issues. Hopefully other custom images will work as well, if not I can adjust those to fix an issues.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/maasserver/preseed.py'
--- src/maasserver/preseed.py 2016-04-18 19:30:35 +0000
+++ src/maasserver/preseed.py 2016-05-03 00:48:52 +0000
@@ -224,15 +224,14 @@
224 "from curtin." % node.hostname)224 "from curtin." % node.hostname)
225 supports_custom_storage = False225 supports_custom_storage = False
226226
227 network_config = compose_curtin_network_config(node)
228
227 if node.osystem != "ubuntu":229 if node.osystem != "ubuntu":
228 maaslog.info(230 maaslog.info(
229 "%s: custom network and storage options are only supported on "231 "%s: custom network and storage options are only supported on "
230 "Ubuntu. Using flat storage layout and OS default network options."232 "Ubuntu. Using flat storage layout."
231 % node.hostname)233 % node.hostname)
232 supports_custom_storage = False234 supports_custom_storage = False
233 network_config = []
234 else:
235 network_config = compose_curtin_network_config(node)
236235
237 if supports_custom_storage:236 if supports_custom_storage:
238 storage_config = compose_curtin_storage_config(node)237 storage_config = compose_curtin_storage_config(node)
239238
=== modified file 'src/maasserver/tests/test_preseed.py'
--- src/maasserver/tests/test_preseed.py 2016-03-28 13:54:47 +0000
+++ src/maasserver/tests/test_preseed.py 2016-05-03 00:48:52 +0000
@@ -765,22 +765,33 @@
765 self.assertThat(mock_compose_storage, MockCalledOnceWith(node))765 self.assertThat(mock_compose_storage, MockCalledOnceWith(node))
766 self.assertThat(mock_compose_network, MockCalledOnceWith(node))766 self.assertThat(mock_compose_network, MockCalledOnceWith(node))
767767
768 def test_get_curtin_userdata_doesnt_call_compose_config_on_otheros(self):768 def test_get_curtin_userdata_skips_storage_for_non_ubuntu(self):
769 node = factory.make_Node_with_Interface_on_Subnet(769 node = factory.make_Node_with_Interface_on_Subnet(
770 primary_rack=self.rpc_rack_controller)770 primary_rack=self.rpc_rack_controller)
771 arch, subarch = node.architecture.split('/')771 arch, subarch = node.architecture.split('/')
772 self.configure_get_boot_images_for_node(node, 'xinstall')772 self.configure_get_boot_images_for_node(node, 'xinstall')
773 mock_compose_storage = self.patch(773 mock_compose_storage = self.patch(
774 preseed_module, "compose_curtin_storage_config")774 preseed_module, "compose_curtin_storage_config")
775 mock_compose_network = self.patch(
776 preseed_module, "compose_curtin_network_config")
777 self.patch(775 self.patch(
778 preseed_module, "curtin_supports_custom_storage").value = True776 preseed_module, "curtin_supports_custom_storage").value = True
779 node.osystem = factory.make_name("osystem")777 node.osystem = factory.make_name("osystem")
780 user_data = get_curtin_userdata(node)778 user_data = get_curtin_userdata(node)
781 self.assertIn("PREFIX='curtin'", user_data)779 self.assertIn("PREFIX='curtin'", user_data)
782 self.assertThat(mock_compose_storage, MockNotCalled())780 self.assertThat(mock_compose_storage, MockNotCalled())
783 self.assertThat(mock_compose_network, MockNotCalled())781
782 def test_get_curtin_userdata_includes_networking_for_non_ubuntu(self):
783 node = factory.make_Node_with_Interface_on_Subnet(
784 primary_rack=self.rpc_rack_controller)
785 arch, subarch = node.architecture.split('/')
786 self.configure_get_boot_images_for_node(node, 'xinstall')
787 mock_compose_network = self.patch(
788 preseed_module, "compose_curtin_network_config")
789 self.patch(
790 preseed_module, "curtin_supports_custom_storage").value = True
791 node.osystem = factory.make_name("osystem")
792 user_data = get_curtin_userdata(node)
793 self.assertIn("PREFIX='curtin'", user_data)
794 self.assertThat(mock_compose_network, MockCalledOnceWith(node))
784795
785 def test_get_curtin_userdata_calls_curtin_supports_custom_storage(self):796 def test_get_curtin_userdata_calls_curtin_supports_custom_storage(self):
786 node = factory.make_Node_with_Interface_on_Subnet(797 node = factory.make_Node_with_Interface_on_Subnet(