Merge lp:~ltrager/maas/remove_di_from_kernel_opts into lp:~maas-committers/maas/trunk

Proposed by Lee Trager
Status: Superseded
Proposed branch: lp:~ltrager/maas/remove_di_from_kernel_opts
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 218 lines (+33/-117)
2 files modified
src/provisioningserver/kernel_opts.py (+27/-69)
src/provisioningserver/tests/test_kernel_opts.py (+6/-48)
To merge this branch: bzr merge lp:~ltrager/maas/remove_di_from_kernel_opts
Reviewer Review Type Date Requested Status
Andres Rodriguez Pending
Review via email: mp+309081@code.launchpad.net

This proposal has been superseded by a proposal from 2016-10-22.

Commit message

Remove deprecated d-i install code from kernel opts.

Description of the change

MAAS supports four netboot options. commissioning, xinstall, enlist, and install. xinstall is MASS's current, and only supported installation boot method which uses Curtin. install was used for deploying using the Debian installer. As that method is no longer supported we can always return the same kernel arguments.

To post a comment you must log in.

Unmerged revisions

5461. By Lee Trager

Remove deprecated d-i install code from kernel opts.

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 2015-12-01 18:12:59 +0000
3+++ src/provisioningserver/kernel_opts.py 2016-10-22 06:27:37 +0000
4@@ -48,21 +48,6 @@
5 __call__ = KernelParametersBase._replace
6
7
8-def compose_preseed_opt(preseed_url):
9- """Compose a kernel option for preseed URL.
10-
11- :param preseed_url: The URL from which a preseed can be fetched.
12- """
13- # See https://help.ubuntu.com/12.04/installation-guide
14- # /i386/preseed-using.html#preseed-auto
15- return "auto url=%s" % preseed_url
16-
17-
18-def compose_locale_opt():
19- locale = 'en_US'
20- return "locale=%s" % locale
21-
22-
23 def compose_logging_opts(log_host):
24 return [
25 'log_host=%s' % log_host,
26@@ -97,61 +82,11 @@
27 )
28
29
30-def compose_hostname_opts(params):
31- """Return list of hostname/domain options based on `params`.
32-
33- The domain is omitted if `params` does not include it.
34- """
35- options = [
36- 'hostname=%s' % params.hostname,
37- ]
38- if params.domain is not None:
39- options.append('domain=%s' % params.domain)
40- return options
41-
42-
43 def prefix_target_name(name):
44 """Prefix an ISCSI target name with the standard target-name prefix."""
45 return "%s:%s" % (ISCSI_TARGET_NAME_PREFIX, name)
46
47
48-def compose_purpose_opts(params):
49- """Return the list of the purpose-specific kernel options."""
50- if params.purpose in ["commissioning", "xinstall", "enlist"]:
51- # These are kernel parameters read by the ephemeral environment.
52- tname = prefix_target_name(
53- get_ephemeral_name(
54- params.osystem, params.arch, params.subarch,
55- params.release, params.label))
56- kernel_params = [
57- # Read by the open-iscsi initramfs code.
58- "iscsi_target_name=%s" % tname,
59- "iscsi_target_ip=%s" % params.fs_host,
60- "iscsi_target_port=3260",
61- "iscsi_initiator=%s" % params.hostname,
62- # Read by cloud-initramfs-dyn-netconf and klibc's ipconfig
63- # in the initramfs.
64- "ip=::::%s:BOOTIF" % params.hostname,
65- # kernel / udev name iscsi devices with this path
66- "ro root=/dev/disk/by-path/ip-%s:%s-iscsi-%s-lun-1" % (
67- params.fs_host, "3260", tname),
68- # Read by overlayroot package.
69- "overlayroot=tmpfs",
70- # Read by cloud-init.
71- "cloud-config-url=%s" % params.preseed_url,
72- ]
73- return kernel_params
74- else:
75- # These are options used by the Debian Installer.
76- return [
77- "netcfg/choose_interface=auto",
78- # Use the text installer, display only critical messages.
79- "text priority=critical",
80- compose_preseed_opt(params.preseed_url),
81- compose_locale_opt(),
82- ] + compose_hostname_opts(params)
83-
84-
85 def compose_arch_opts(params):
86 """Return any architecture-specific options required"""
87 arch_subarch = '%s/%s' % (params.arch, params.subarch)
88@@ -176,10 +111,33 @@
89
90 :type params: `KernelParameters`.
91 """
92- options = []
93- # nomodeset prevents video mode switching.
94- options += ["nomodeset"]
95- options += compose_purpose_opts(params)
96+ # These are kernel parameters read by the ephemeral environment.
97+ tname = prefix_target_name(
98+ get_ephemeral_name(
99+ params.osystem, params.arch, params.subarch,
100+ params.release, params.label))
101+ options = [
102+ # nomodeset prevents video mode switching.
103+ "nomodeset",
104+ # Read by the open-iscsi initramfs code.
105+ "iscsi_target_name=%s" % tname,
106+ "iscsi_target_ip=%s" % params.fs_host,
107+ "iscsi_target_port=3260",
108+ "iscsi_initiator=%s" % params.hostname,
109+ # Read by cloud-initramfs-dyn-netconf and klibc's ipconfig
110+ # in the initramfs.
111+ "ip=::::%s:BOOTIF" % params.hostname,
112+ # kernel / udev name iscsi devices with this path
113+ "ro root=/dev/disk/by-path/ip-%s:%s-iscsi-%s-lun-1" % (
114+ params.fs_host, "3260", tname),
115+ # Read by overlayroot package.
116+ "overlayroot=tmpfs",
117+ # LP:1533822 - Disable reading overlay data from disk.
118+ "overlayroot_cfgdisk=disabled",
119+ # Read by cloud-init.
120+ "cloud-config-url=%s" % params.preseed_url,
121+ ]
122+
123 # Note: logging opts are not respected by ephemeral images, so
124 # these are actually "purpose_opts" but were left generic
125 # as it would be nice to have.
126
127=== modified file 'src/provisioningserver/tests/test_kernel_opts.py'
128--- src/provisioningserver/tests/test_kernel_opts.py 2016-06-22 17:03:02 +0000
129+++ src/provisioningserver/tests/test_kernel_opts.py 2016-10-22 06:27:37 +0000
130@@ -8,6 +8,7 @@
131 ]
132
133 import os
134+import random
135 from unittest.mock import sentinel
136
137 from maastesting.factory import factory
138@@ -20,7 +21,6 @@
139 from provisioningserver.kernel_opts import (
140 compose_arch_opts,
141 compose_kernel_command_line,
142- compose_preseed_opt,
143 CURTIN_KERNEL_CMDLINE_NAME,
144 get_curtin_kernel_cmdline_sep,
145 get_ephemeral_name,
146@@ -128,33 +128,11 @@
147 def make_kernel_parameters(self, *args, **kwargs):
148 return make_kernel_parameters(self, *args, **kwargs)
149
150- def test_compose_kernel_command_line_includes_preseed_url(self):
151- params = self.make_kernel_parameters()
152- self.assertIn(
153- "auto url=%s" % params.preseed_url,
154- compose_kernel_command_line(params))
155-
156- def test_install_compose_kernel_command_line_includes_name_domain(self):
157- params = self.make_kernel_parameters(purpose="install")
158- self.assertThat(
159- compose_kernel_command_line(params),
160- ContainsAll([
161- "hostname=%s" % params.hostname,
162- "domain=%s" % params.domain,
163- ]))
164-
165- def test_install_compose_kernel_command_line_omits_domain_if_omitted(self):
166- params = self.make_kernel_parameters(purpose="install", domain=None)
167- kernel_command_line = compose_kernel_command_line(params)
168- self.assertIn("hostname=%s" % params.hostname, kernel_command_line)
169- self.assertNotIn('domain=', kernel_command_line)
170-
171- def test_install_compose_kernel_command_line_includes_locale(self):
172- params = self.make_kernel_parameters(purpose="install")
173- locale = "en_US"
174- self.assertIn(
175- "locale=%s" % locale,
176- compose_kernel_command_line(params))
177+ def test_compose_kernel_command_line_includes_disable_overlay_cfg(self):
178+ params = self.make_kernel_parameters(
179+ purpose=random.choice(["commissioning", "xinstall", "enlist"]))
180+ cmdline = compose_kernel_command_line(params)
181+ self.assertThat(cmdline, Contains("overlayroot_cfgdisk=disabled"))
182
183 def test_install_compose_kernel_command_line_includes_log_settings(self):
184 params = self.make_kernel_parameters(purpose="install")
185@@ -167,20 +145,6 @@
186 "log_port=%s" % log_port,
187 ]))
188
189- def test_install_compose_kernel_command_line_includes_di_settings(self):
190- params = self.make_kernel_parameters(purpose="install")
191- self.assertThat(
192- compose_kernel_command_line(params),
193- Contains("text priority=critical"))
194-
195- def test_install_compose_kernel_command_line_inc_purpose_opts(self):
196- # The result of compose_kernel_command_line includes the purpose
197- # options for a non "commissioning" node.
198- params = self.make_kernel_parameters(purpose="install")
199- self.assertIn(
200- "netcfg/choose_interface=auto",
201- compose_kernel_command_line(params))
202-
203 def test_xinstall_compose_kernel_command_line_inc_purpose_opts(self):
204 # The result of compose_kernel_command_line includes the purpose
205 # options for a non "xinstall" node.
206@@ -289,12 +253,6 @@
207 "iscsi_target_ip=%s" % params.fs_host,
208 ]))
209
210- def test_compose_preseed_kernel_opt_returns_kernel_option(self):
211- dummy_preseed_url = factory.make_name("url")
212- self.assertEqual(
213- "auto url=%s" % dummy_preseed_url,
214- compose_preseed_opt(dummy_preseed_url))
215-
216 def test_compose_kernel_command_line_inc_arm_specific_option(self):
217 params = self.make_kernel_parameters(arch="armhf", subarch="highbank")
218 self.assertThat(