Merge lp:~andreserl/maas/lp1582323 into lp:maas/trunk

Proposed by Andres Rodriguez on 2016-12-06
Status: Merged
Approved by: Andres Rodriguez on 2016-12-06
Approved revision: 5587
Merged at revision: 5586
Proposed branch: lp:~andreserl/maas/lp1582323
Merge into: lp:maas/trunk
Diff against target: 73 lines (+38/-0)
2 files modified
src/provisioningserver/kernel_opts.py (+2/-0)
src/provisioningserver/tests/test_kernel_opts.py (+36/-0)
To merge this branch: bzr merge lp:~andreserl/maas/lp1582323
Reviewer Review Type Date Requested Status
Blake Rouse (community) 2016-12-06 Approve on 2016-12-06
Review via email: mp+312534@code.launchpad.net

Commit message

Select MAAS datasource specifically to ensure commissioning doesn't fail when competing cloud metadata resides on disk

To post a comment you must log in.
lp:~andreserl/maas/lp1582323 updated on 2016-12-06
5587. By Andres Rodriguez on 2016-12-06

Add missing tests

Blake Rouse (blake-rouse) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/provisioningserver/kernel_opts.py'
2--- src/provisioningserver/kernel_opts.py 2016-11-07 09:56:02 +0000
3+++ src/provisioningserver/kernel_opts.py 2016-12-06 09:57:53 +0000
4@@ -150,6 +150,8 @@
5 params.fs_host, "3260", tname),
6 # Read by overlayroot package.
7 "overlayroot=tmpfs",
8+ # Select the MAAS datasource by default.
9+ "cc:{'datasource_list': ['MAAS']}end_cc",
10 # Read by cloud-init.
11 "cloud-config-url=%s" % params.preseed_url,
12 ]
13
14=== modified file 'src/provisioningserver/tests/test_kernel_opts.py'
15--- src/provisioningserver/tests/test_kernel_opts.py 2016-10-28 15:36:39 +0000
16+++ src/provisioningserver/tests/test_kernel_opts.py 2016-12-06 09:57:53 +0000
17@@ -214,6 +214,18 @@
18 "ip=off",
19 "ip6=dhcp"]))
20
21+ def test_xinstall_compose_kernel_command_line_inc_cc_datasource(self):
22+ # The result of compose_kernel_command_line includes the cloud-init
23+ # options for the datasource and cloud-config-url
24+ params = self.make_kernel_parameters(
25+ purpose="xinstall", fs_host=factory.make_ipv4_address())
26+ cmdline = compose_kernel_command_line(params)
27+ self.assertThat(
28+ cmdline,
29+ ContainsAll([
30+ "cc:{'datasource_list': ['MAAS']}end_cc",
31+ "cloud-config-url=%s" % params.preseed_url]))
32+
33 def test_commissioning_compose_kernel_command_line_inc_purpose_opts4(self):
34 # The result of compose_kernel_command_line includes the purpose
35 # options for a non "commissioning" node.
36@@ -244,6 +256,18 @@
37 "ip=off",
38 "ip6=dhcp"]))
39
40+ def test_commissioning_compose_kernel_command_line_inc_cc_datasource(self):
41+ # The result of compose_kernel_command_line includes the cloud-init
42+ # options for the datasource and cloud-config-url
43+ params = self.make_kernel_parameters(
44+ purpose="commissioning", fs_host=factory.make_ipv4_address())
45+ cmdline = compose_kernel_command_line(params)
46+ self.assertThat(
47+ cmdline,
48+ ContainsAll([
49+ "cc:{'datasource_list': ['MAAS']}end_cc",
50+ "cloud-config-url=%s" % params.preseed_url]))
51+
52 def test_enlist_compose_kernel_command_line_inc_purpose_opts4(self):
53 # The result of compose_kernel_command_line includes the purpose
54 # options for a non "commissioning" node.
55@@ -274,6 +298,18 @@
56 "ip=off",
57 "ip6=dhcp"]))
58
59+ def test_enlist_compose_kernel_command_line_inc_cc_datasource(self):
60+ # The result of compose_kernel_command_line includes the cloud-init
61+ # options for the datasource and cloud-config-url
62+ params = self.make_kernel_parameters(
63+ purpose="enlist", fs_host=factory.make_ipv4_address())
64+ cmdline = compose_kernel_command_line(params)
65+ self.assertThat(
66+ cmdline,
67+ ContainsAll([
68+ "cc:{'datasource_list': ['MAAS']}end_cc",
69+ "cloud-config-url=%s" % params.preseed_url]))
70+
71 def test_commissioning_compose_kernel_command_line_inc_extra_opts(self):
72 mock_get_curtin_sep = self.patch(
73 kernel_opts, 'get_curtin_kernel_cmdline_sep')