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
=== modified file 'src/provisioningserver/kernel_opts.py'
--- src/provisioningserver/kernel_opts.py 2016-10-22 06:28:12 +0000
+++ src/provisioningserver/kernel_opts.py 2016-10-22 06:28:12 +0000
@@ -48,21 +48,6 @@
48 __call__ = KernelParametersBase._replace48 __call__ = KernelParametersBase._replace
4949
5050
51def compose_preseed_opt(preseed_url):
52 """Compose a kernel option for preseed URL.
53
54 :param preseed_url: The URL from which a preseed can be fetched.
55 """
56 # See https://help.ubuntu.com/12.04/installation-guide
57 # /i386/preseed-using.html#preseed-auto
58 return "auto url=%s" % preseed_url
59
60
61def compose_locale_opt():
62 locale = 'en_US'
63 return "locale=%s" % locale
64
65
66def compose_logging_opts(log_host):51def compose_logging_opts(log_host):
67 return [52 return [
68 'log_host=%s' % log_host,53 'log_host=%s' % log_host,
@@ -97,63 +82,11 @@
97 )82 )
9883
9984
100def compose_hostname_opts(params):
101 """Return list of hostname/domain options based on `params`.
102
103 The domain is omitted if `params` does not include it.
104 """
105 options = [
106 'hostname=%s' % params.hostname,
107 ]
108 if params.domain is not None:
109 options.append('domain=%s' % params.domain)
110 return options
111
112
113def prefix_target_name(name):85def prefix_target_name(name):
114 """Prefix an ISCSI target name with the standard target-name prefix."""86 """Prefix an ISCSI target name with the standard target-name prefix."""
115 return "%s:%s" % (ISCSI_TARGET_NAME_PREFIX, name)87 return "%s:%s" % (ISCSI_TARGET_NAME_PREFIX, name)
11688
11789
118def compose_purpose_opts(params):
119 """Return the list of the purpose-specific kernel options."""
120 if params.purpose in ["commissioning", "xinstall", "enlist"]:
121 # These are kernel parameters read by the ephemeral environment.
122 tname = prefix_target_name(
123 get_ephemeral_name(
124 params.osystem, params.arch, params.subarch,
125 params.release, params.label))
126 kernel_params = [
127 # Read by the open-iscsi initramfs code.
128 "iscsi_target_name=%s" % tname,
129 "iscsi_target_ip=%s" % params.fs_host,
130 "iscsi_target_port=3260",
131 "iscsi_initiator=%s" % params.hostname,
132 # Read by cloud-initramfs-dyn-netconf and klibc's ipconfig
133 # in the initramfs.
134 "ip=::::%s:BOOTIF" % params.hostname,
135 # kernel / udev name iscsi devices with this path
136 "ro root=/dev/disk/by-path/ip-%s:%s-iscsi-%s-lun-1" % (
137 params.fs_host, "3260", tname),
138 # Read by overlayroot package.
139 "overlayroot=tmpfs",
140 # LP:1533822 - Disable reading overlay data from disk.
141 "overlayroot_cfgdisk=disabled",
142 # Read by cloud-init.
143 "cloud-config-url=%s" % params.preseed_url,
144 ]
145 return kernel_params
146 else:
147 # These are options used by the Debian Installer.
148 return [
149 "netcfg/choose_interface=auto",
150 # Use the text installer, display only critical messages.
151 "text priority=critical",
152 compose_preseed_opt(params.preseed_url),
153 compose_locale_opt(),
154 ] + compose_hostname_opts(params)
155
156
157def compose_arch_opts(params):90def compose_arch_opts(params):
158 """Return any architecture-specific options required"""91 """Return any architecture-specific options required"""
159 arch_subarch = '%s/%s' % (params.arch, params.subarch)92 arch_subarch = '%s/%s' % (params.arch, params.subarch)
@@ -178,10 +111,33 @@
178111
179 :type params: `KernelParameters`.112 :type params: `KernelParameters`.
180 """113 """
181 options = []114 # These are kernel parameters read by the ephemeral environment.
182 # nomodeset prevents video mode switching.115 tname = prefix_target_name(
183 options += ["nomodeset"]116 get_ephemeral_name(
184 options += compose_purpose_opts(params)117 params.osystem, params.arch, params.subarch,
118 params.release, params.label))
119 options = [
120 # nomodeset prevents video mode switching.
121 "nomodeset",
122 # Read by the open-iscsi initramfs code.
123 "iscsi_target_name=%s" % tname,
124 "iscsi_target_ip=%s" % params.fs_host,
125 "iscsi_target_port=3260",
126 "iscsi_initiator=%s" % params.hostname,
127 # Read by cloud-initramfs-dyn-netconf and klibc's ipconfig
128 # in the initramfs.
129 "ip=::::%s:BOOTIF" % params.hostname,
130 # kernel / udev name iscsi devices with this path
131 "ro root=/dev/disk/by-path/ip-%s:%s-iscsi-%s-lun-1" % (
132 params.fs_host, "3260", tname),
133 # Read by overlayroot package.
134 "overlayroot=tmpfs",
135 # LP:1533822 - Disable reading overlay data from disk.
136 "overlayroot_cfgdisk=disabled",
137 # Read by cloud-init.
138 "cloud-config-url=%s" % params.preseed_url,
139 ]
140
185 # Note: logging opts are not respected by ephemeral images, so141 # Note: logging opts are not respected by ephemeral images, so
186 # these are actually "purpose_opts" but were left generic142 # these are actually "purpose_opts" but were left generic
187 # as it would be nice to have.143 # as it would be nice to have.
188144
=== modified file 'src/provisioningserver/tests/test_kernel_opts.py'
--- src/provisioningserver/tests/test_kernel_opts.py 2016-10-22 06:28:12 +0000
+++ src/provisioningserver/tests/test_kernel_opts.py 2016-10-22 06:28:12 +0000
@@ -21,7 +21,6 @@
21from provisioningserver.kernel_opts import (21from provisioningserver.kernel_opts import (
22 compose_arch_opts,22 compose_arch_opts,
23 compose_kernel_command_line,23 compose_kernel_command_line,
24 compose_preseed_opt,
25 CURTIN_KERNEL_CMDLINE_NAME,24 CURTIN_KERNEL_CMDLINE_NAME,
26 get_curtin_kernel_cmdline_sep,25 get_curtin_kernel_cmdline_sep,
27 get_ephemeral_name,26 get_ephemeral_name,
@@ -135,34 +134,6 @@
135 cmdline = compose_kernel_command_line(params)134 cmdline = compose_kernel_command_line(params)
136 self.assertThat(cmdline, Contains("overlayroot_cfgdisk=disabled"))135 self.assertThat(cmdline, Contains("overlayroot_cfgdisk=disabled"))
137136
138 def test_compose_kernel_command_line_includes_preseed_url(self):
139 params = self.make_kernel_parameters()
140 self.assertIn(
141 "auto url=%s" % params.preseed_url,
142 compose_kernel_command_line(params))
143
144 def test_install_compose_kernel_command_line_includes_name_domain(self):
145 params = self.make_kernel_parameters(purpose="install")
146 self.assertThat(
147 compose_kernel_command_line(params),
148 ContainsAll([
149 "hostname=%s" % params.hostname,
150 "domain=%s" % params.domain,
151 ]))
152
153 def test_install_compose_kernel_command_line_omits_domain_if_omitted(self):
154 params = self.make_kernel_parameters(purpose="install", domain=None)
155 kernel_command_line = compose_kernel_command_line(params)
156 self.assertIn("hostname=%s" % params.hostname, kernel_command_line)
157 self.assertNotIn('domain=', kernel_command_line)
158
159 def test_install_compose_kernel_command_line_includes_locale(self):
160 params = self.make_kernel_parameters(purpose="install")
161 locale = "en_US"
162 self.assertIn(
163 "locale=%s" % locale,
164 compose_kernel_command_line(params))
165
166 def test_install_compose_kernel_command_line_includes_log_settings(self):137 def test_install_compose_kernel_command_line_includes_log_settings(self):
167 params = self.make_kernel_parameters(purpose="install")138 params = self.make_kernel_parameters(purpose="install")
168 # Port 514 (UDP) is syslog.139 # Port 514 (UDP) is syslog.
@@ -174,20 +145,6 @@
174 "log_port=%s" % log_port,145 "log_port=%s" % log_port,
175 ]))146 ]))
176147
177 def test_install_compose_kernel_command_line_includes_di_settings(self):
178 params = self.make_kernel_parameters(purpose="install")
179 self.assertThat(
180 compose_kernel_command_line(params),
181 Contains("text priority=critical"))
182
183 def test_install_compose_kernel_command_line_inc_purpose_opts(self):
184 # The result of compose_kernel_command_line includes the purpose
185 # options for a non "commissioning" node.
186 params = self.make_kernel_parameters(purpose="install")
187 self.assertIn(
188 "netcfg/choose_interface=auto",
189 compose_kernel_command_line(params))
190
191 def test_xinstall_compose_kernel_command_line_inc_purpose_opts(self):148 def test_xinstall_compose_kernel_command_line_inc_purpose_opts(self):
192 # The result of compose_kernel_command_line includes the purpose149 # The result of compose_kernel_command_line includes the purpose
193 # options for a non "xinstall" node.150 # options for a non "xinstall" node.
@@ -296,12 +253,6 @@
296 "iscsi_target_ip=%s" % params.fs_host,253 "iscsi_target_ip=%s" % params.fs_host,
297 ]))254 ]))
298255
299 def test_compose_preseed_kernel_opt_returns_kernel_option(self):
300 dummy_preseed_url = factory.make_name("url")
301 self.assertEqual(
302 "auto url=%s" % dummy_preseed_url,
303 compose_preseed_opt(dummy_preseed_url))
304
305 def test_compose_kernel_command_line_inc_arm_specific_option(self):256 def test_compose_kernel_command_line_inc_arm_specific_option(self):
306 params = self.make_kernel_parameters(arch="armhf", subarch="highbank")257 params = self.make_kernel_parameters(arch="armhf", subarch="highbank")
307 self.assertThat(258 self.assertThat(