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

Proposed by Lee Trager
Status: Rejected
Rejected by: MAAS Lander
Proposed branch: lp:~ltrager/maas/remove_di_from_kernel_opts
Merge into: lp:~maas-committers/maas/trunk
Prerequisite: lp:~ltrager/maas/lp1533822
Diff against target: 208 lines (+27/-120)
2 files modified
src/provisioningserver/kernel_opts.py (+27/-71)
src/provisioningserver/tests/test_kernel_opts.py (+0/-49)
To merge this branch: bzr merge lp:~ltrager/maas/remove_di_from_kernel_opts
Reviewer Review Type Date Requested Status
Andres Rodriguez (community) Needs Fixing
Gavin Panella (community) Approve
Review via email: mp+309082@code.launchpad.net

This proposal supersedes 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.
Revision history for this message
Gavin Panella (allenap) :
review: Approve
Revision history for this message
Andres Rodriguez (andreserl) wrote :

This doesn't really need fixing, but I want to keep this around for a bit longer provided that Caringo will make changes around this area.

review: Needs Fixing
Revision history for this message
Mike Pontillo (mpontillo) wrote :

Are we still planning on landing this?

Revision history for this message
MAAS Lander (maas-lander) wrote :

Transitioned to Git.

lp:maas has now moved from Bzr to Git.
Please propose your branches with Launchpad using Git.

git clone https://git.launchpad.net/maas

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 2016-10-22 06:28:12 +0000
3+++ src/provisioningserver/kernel_opts.py 2016-10-22 06:28:12 +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,63 +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- # LP:1533822 - Disable reading overlay data from disk.
71- "overlayroot_cfgdisk=disabled",
72- # Read by cloud-init.
73- "cloud-config-url=%s" % params.preseed_url,
74- ]
75- return kernel_params
76- else:
77- # These are options used by the Debian Installer.
78- return [
79- "netcfg/choose_interface=auto",
80- # Use the text installer, display only critical messages.
81- "text priority=critical",
82- compose_preseed_opt(params.preseed_url),
83- compose_locale_opt(),
84- ] + compose_hostname_opts(params)
85-
86-
87 def compose_arch_opts(params):
88 """Return any architecture-specific options required"""
89 arch_subarch = '%s/%s' % (params.arch, params.subarch)
90@@ -178,10 +111,33 @@
91
92 :type params: `KernelParameters`.
93 """
94- options = []
95- # nomodeset prevents video mode switching.
96- options += ["nomodeset"]
97- options += compose_purpose_opts(params)
98+ # These are kernel parameters read by the ephemeral environment.
99+ tname = prefix_target_name(
100+ get_ephemeral_name(
101+ params.osystem, params.arch, params.subarch,
102+ params.release, params.label))
103+ options = [
104+ # nomodeset prevents video mode switching.
105+ "nomodeset",
106+ # Read by the open-iscsi initramfs code.
107+ "iscsi_target_name=%s" % tname,
108+ "iscsi_target_ip=%s" % params.fs_host,
109+ "iscsi_target_port=3260",
110+ "iscsi_initiator=%s" % params.hostname,
111+ # Read by cloud-initramfs-dyn-netconf and klibc's ipconfig
112+ # in the initramfs.
113+ "ip=::::%s:BOOTIF" % params.hostname,
114+ # kernel / udev name iscsi devices with this path
115+ "ro root=/dev/disk/by-path/ip-%s:%s-iscsi-%s-lun-1" % (
116+ params.fs_host, "3260", tname),
117+ # Read by overlayroot package.
118+ "overlayroot=tmpfs",
119+ # LP:1533822 - Disable reading overlay data from disk.
120+ "overlayroot_cfgdisk=disabled",
121+ # Read by cloud-init.
122+ "cloud-config-url=%s" % params.preseed_url,
123+ ]
124+
125 # Note: logging opts are not respected by ephemeral images, so
126 # these are actually "purpose_opts" but were left generic
127 # as it would be nice to have.
128
129=== modified file 'src/provisioningserver/tests/test_kernel_opts.py'
130--- src/provisioningserver/tests/test_kernel_opts.py 2016-10-22 06:28:12 +0000
131+++ src/provisioningserver/tests/test_kernel_opts.py 2016-10-22 06:28:12 +0000
132@@ -21,7 +21,6 @@
133 from provisioningserver.kernel_opts import (
134 compose_arch_opts,
135 compose_kernel_command_line,
136- compose_preseed_opt,
137 CURTIN_KERNEL_CMDLINE_NAME,
138 get_curtin_kernel_cmdline_sep,
139 get_ephemeral_name,
140@@ -135,34 +134,6 @@
141 cmdline = compose_kernel_command_line(params)
142 self.assertThat(cmdline, Contains("overlayroot_cfgdisk=disabled"))
143
144- def test_compose_kernel_command_line_includes_preseed_url(self):
145- params = self.make_kernel_parameters()
146- self.assertIn(
147- "auto url=%s" % params.preseed_url,
148- compose_kernel_command_line(params))
149-
150- def test_install_compose_kernel_command_line_includes_name_domain(self):
151- params = self.make_kernel_parameters(purpose="install")
152- self.assertThat(
153- compose_kernel_command_line(params),
154- ContainsAll([
155- "hostname=%s" % params.hostname,
156- "domain=%s" % params.domain,
157- ]))
158-
159- def test_install_compose_kernel_command_line_omits_domain_if_omitted(self):
160- params = self.make_kernel_parameters(purpose="install", domain=None)
161- kernel_command_line = compose_kernel_command_line(params)
162- self.assertIn("hostname=%s" % params.hostname, kernel_command_line)
163- self.assertNotIn('domain=', kernel_command_line)
164-
165- def test_install_compose_kernel_command_line_includes_locale(self):
166- params = self.make_kernel_parameters(purpose="install")
167- locale = "en_US"
168- self.assertIn(
169- "locale=%s" % locale,
170- compose_kernel_command_line(params))
171-
172 def test_install_compose_kernel_command_line_includes_log_settings(self):
173 params = self.make_kernel_parameters(purpose="install")
174 # Port 514 (UDP) is syslog.
175@@ -174,20 +145,6 @@
176 "log_port=%s" % log_port,
177 ]))
178
179- def test_install_compose_kernel_command_line_includes_di_settings(self):
180- params = self.make_kernel_parameters(purpose="install")
181- self.assertThat(
182- compose_kernel_command_line(params),
183- Contains("text priority=critical"))
184-
185- def test_install_compose_kernel_command_line_inc_purpose_opts(self):
186- # The result of compose_kernel_command_line includes the purpose
187- # options for a non "commissioning" node.
188- params = self.make_kernel_parameters(purpose="install")
189- self.assertIn(
190- "netcfg/choose_interface=auto",
191- compose_kernel_command_line(params))
192-
193 def test_xinstall_compose_kernel_command_line_inc_purpose_opts(self):
194 # The result of compose_kernel_command_line includes the purpose
195 # options for a non "xinstall" node.
196@@ -296,12 +253,6 @@
197 "iscsi_target_ip=%s" % params.fs_host,
198 ]))
199
200- def test_compose_preseed_kernel_opt_returns_kernel_option(self):
201- dummy_preseed_url = factory.make_name("url")
202- self.assertEqual(
203- "auto url=%s" % dummy_preseed_url,
204- compose_preseed_opt(dummy_preseed_url))
205-
206 def test_compose_kernel_command_line_inc_arm_specific_option(self):
207 params = self.make_kernel_parameters(arch="armhf", subarch="highbank")
208 self.assertThat(