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
1=== modified file 'src/maasserver/preseed.py'
2--- src/maasserver/preseed.py 2016-04-18 19:30:35 +0000
3+++ src/maasserver/preseed.py 2016-05-03 00:48:52 +0000
4@@ -224,15 +224,14 @@
5 "from curtin." % node.hostname)
6 supports_custom_storage = False
7
8+ network_config = compose_curtin_network_config(node)
9+
10 if node.osystem != "ubuntu":
11 maaslog.info(
12 "%s: custom network and storage options are only supported on "
13- "Ubuntu. Using flat storage layout and OS default network options."
14+ "Ubuntu. Using flat storage layout."
15 % node.hostname)
16 supports_custom_storage = False
17- network_config = []
18- else:
19- network_config = compose_curtin_network_config(node)
20
21 if supports_custom_storage:
22 storage_config = compose_curtin_storage_config(node)
23
24=== modified file 'src/maasserver/tests/test_preseed.py'
25--- src/maasserver/tests/test_preseed.py 2016-03-28 13:54:47 +0000
26+++ src/maasserver/tests/test_preseed.py 2016-05-03 00:48:52 +0000
27@@ -765,22 +765,33 @@
28 self.assertThat(mock_compose_storage, MockCalledOnceWith(node))
29 self.assertThat(mock_compose_network, MockCalledOnceWith(node))
30
31- def test_get_curtin_userdata_doesnt_call_compose_config_on_otheros(self):
32+ def test_get_curtin_userdata_skips_storage_for_non_ubuntu(self):
33 node = factory.make_Node_with_Interface_on_Subnet(
34 primary_rack=self.rpc_rack_controller)
35 arch, subarch = node.architecture.split('/')
36 self.configure_get_boot_images_for_node(node, 'xinstall')
37 mock_compose_storage = self.patch(
38 preseed_module, "compose_curtin_storage_config")
39- mock_compose_network = self.patch(
40- preseed_module, "compose_curtin_network_config")
41 self.patch(
42 preseed_module, "curtin_supports_custom_storage").value = True
43 node.osystem = factory.make_name("osystem")
44 user_data = get_curtin_userdata(node)
45 self.assertIn("PREFIX='curtin'", user_data)
46 self.assertThat(mock_compose_storage, MockNotCalled())
47- self.assertThat(mock_compose_network, MockNotCalled())
48+
49+ def test_get_curtin_userdata_includes_networking_for_non_ubuntu(self):
50+ node = factory.make_Node_with_Interface_on_Subnet(
51+ primary_rack=self.rpc_rack_controller)
52+ arch, subarch = node.architecture.split('/')
53+ self.configure_get_boot_images_for_node(node, 'xinstall')
54+ mock_compose_network = self.patch(
55+ preseed_module, "compose_curtin_network_config")
56+ self.patch(
57+ preseed_module, "curtin_supports_custom_storage").value = True
58+ node.osystem = factory.make_name("osystem")
59+ user_data = get_curtin_userdata(node)
60+ self.assertIn("PREFIX='curtin'", user_data)
61+ self.assertThat(mock_compose_network, MockCalledOnceWith(node))
62
63 def test_get_curtin_userdata_calls_curtin_supports_custom_storage(self):
64 node = factory.make_Node_with_Interface_on_Subnet(