Merge ~alexsander-souza/maas:lp1914812_to_3_4 into maas:3.4
- Git
- lp:~alexsander-souza/maas
- lp1914812_to_3_4
- Merge into 3.4
Proposed by
Alexsander de Souza
Status: | Merged |
---|---|
Approved by: | Alexsander de Souza |
Approved revision: | 820b74b82723396e8d58c4ec6bbc8994df263194 |
Merge reported by: | MAAS Lander |
Merged at revision: | not available |
Proposed branch: | ~alexsander-souza/maas:lp1914812_to_3_4 |
Merge into: | maas:3.4 |
Diff against target: |
340 lines (+129/-10) 6 files modified
src/maasserver/rpc/boot.py (+26/-4) src/maasserver/rpc/tests/test_boot.py (+81/-6) src/maasserver/rpc/tests/test_regionservice_calls.py (+1/-0) src/provisioningserver/kernel_opts.py (+3/-0) src/provisioningserver/rpc/region.py (+1/-0) src/provisioningserver/tests/test_kernel_opts.py (+17/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexsander de Souza | Approve | ||
MAAS Lander | Approve | ||
Review via email:
|
Commit message
add support to quirks in the ephemeral kernel during xinstall
Some older OSes (like Centos/7) require that we tune the ephemeral OS kernel to match the capabilities of the one being deployed.
(cherry picked from commit 52f344ab28c0e61
Description of the change
To post a comment you must log in.
Revision history for this message

Alexsander de Souza (alexsander-souza) wrote : | # |
self-approve back-port
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/src/maasserver/rpc/boot.py b/src/maasserver/rpc/boot.py | |||
2 | index c850aa7..931a7e0 100644 | |||
3 | --- a/src/maasserver/rpc/boot.py | |||
4 | +++ b/src/maasserver/rpc/boot.py | |||
5 | @@ -223,11 +223,13 @@ def get_boot_config_for_machine(machine, configs, purpose): | |||
6 | 223 | # LP:2013529, machine HWE kernel might not exist for | 223 | # LP:2013529, machine HWE kernel might not exist for |
7 | 224 | # commissioning osystem/series | 224 | # commissioning osystem/series |
8 | 225 | use_machine_hwe_kernel = False | 225 | use_machine_hwe_kernel = False |
9 | 226 | final_osystem, final_series = osystem, series | ||
10 | 226 | else: | 227 | else: |
11 | 227 | osystem = machine.get_osystem(default=configs["default_osystem"]) | 228 | osystem = machine.get_osystem(default=configs["default_osystem"]) |
12 | 228 | series = machine.get_distro_series( | 229 | series = machine.get_distro_series( |
13 | 229 | default=configs["default_distro_series"] | 230 | default=configs["default_distro_series"] |
14 | 230 | ) | 231 | ) |
15 | 232 | final_osystem, final_series = osystem, series | ||
16 | 231 | # XXX: roaksoax LP: #1739761 - Since the switch to squashfs (and | 233 | # XXX: roaksoax LP: #1739761 - Since the switch to squashfs (and |
17 | 232 | # drop of iscsi), precise is no longer deployable. To address a | 234 | # drop of iscsi), precise is no longer deployable. To address a |
18 | 233 | # squashfs image is made available allowing it to be deployed in | 235 | # squashfs image is made available allowing it to be deployed in |
19 | @@ -317,7 +319,7 @@ def get_boot_config_for_machine(machine, configs, purpose): | |||
20 | 317 | else: | 319 | else: |
21 | 318 | subarch = "no-such-kernel" | 320 | subarch = "no-such-kernel" |
22 | 319 | 321 | ||
24 | 320 | return osystem, series, subarch | 322 | return osystem, series, subarch, final_osystem, final_series |
25 | 321 | 323 | ||
26 | 322 | 324 | ||
27 | 323 | def get_base_url_for_local_ip(local_ip, internal_domain): | 325 | def get_base_url_for_local_ip(local_ip, internal_domain): |
28 | @@ -352,6 +354,15 @@ def get_final_boot_purpose(machine, arch, purpose): | |||
29 | 352 | return purpose | 354 | return purpose |
30 | 353 | 355 | ||
31 | 354 | 356 | ||
32 | 357 | def get_quirks_kernel_opts( | ||
33 | 358 | final_osystem: str, final_series: str | ||
34 | 359 | ) -> str | None: | ||
35 | 360 | if final_osystem == "centos": | ||
36 | 361 | return "nvme-core.multipath=0" | ||
37 | 362 | |||
38 | 363 | return None | ||
39 | 364 | |||
40 | 365 | |||
41 | 355 | @synchronous | 366 | @synchronous |
42 | 356 | @transactional | 367 | @transactional |
43 | 357 | def get_config( | 368 | def get_config( |
44 | @@ -418,6 +429,7 @@ def get_config( | |||
45 | 418 | if log_port is None: | 429 | if log_port is None: |
46 | 419 | log_port = 514 # Fallback to default UDP syslog port. | 430 | log_port = 514 # Fallback to default UDP syslog port. |
47 | 420 | 431 | ||
48 | 432 | ephemeral_opts: str | None = None | ||
49 | 421 | # XXX: Instead of updating the machine directly, we should store the | 433 | # XXX: Instead of updating the machine directly, we should store the |
50 | 422 | # information and update the machine later. The current code doesn't | 434 | # information and update the machine later. The current code doesn't |
51 | 423 | # work when you first boot a machine that has IPMI configured, since | 435 | # work when you first boot a machine that has IPMI configured, since |
52 | @@ -542,6 +554,7 @@ def get_config( | |||
53 | 542 | "log_port": log_port, | 554 | "log_port": log_port, |
54 | 543 | "extra_opts": "", | 555 | "extra_opts": "", |
55 | 544 | "http_boot": True, | 556 | "http_boot": True, |
56 | 557 | "ephemeral_opts": ephemeral_opts or "", | ||
57 | 545 | } | 558 | } |
58 | 546 | 559 | ||
59 | 547 | # Log the request into the event log for that machine. | 560 | # Log the request into the event log for that machine. |
60 | @@ -554,9 +567,13 @@ def get_config( | |||
61 | 554 | else: | 567 | else: |
62 | 555 | event_log_pxe_request(machine, purpose) | 568 | event_log_pxe_request(machine, purpose) |
63 | 556 | 569 | ||
67 | 557 | osystem, series, subarch = get_boot_config_for_machine( | 570 | ( |
68 | 558 | machine, configs, purpose | 571 | osystem, |
69 | 559 | ) | 572 | series, |
70 | 573 | subarch, | ||
71 | 574 | final_osystem, | ||
72 | 575 | final_series, | ||
73 | 576 | ) = get_boot_config_for_machine(machine, configs, purpose) | ||
74 | 560 | 577 | ||
75 | 561 | extra_kernel_opts = machine.get_effective_kernel_options( | 578 | extra_kernel_opts = machine.get_effective_kernel_options( |
76 | 562 | default_kernel_opts=configs["kernel_opts"] | 579 | default_kernel_opts=configs["kernel_opts"] |
77 | @@ -580,6 +597,10 @@ def get_config( | |||
78 | 580 | extra_kernel_opts = merge_kparams_with_extra( | 597 | extra_kernel_opts = merge_kparams_with_extra( |
79 | 581 | kparams, extra_kernel_opts | 598 | kparams, extra_kernel_opts |
80 | 582 | ) | 599 | ) |
81 | 600 | if final_osystem != "ubuntu": | ||
82 | 601 | ephemeral_opts = get_quirks_kernel_opts( | ||
83 | 602 | final_osystem, final_series | ||
84 | 603 | ) | ||
85 | 583 | else: | 604 | else: |
86 | 584 | purpose = "commissioning" # enlistment | 605 | purpose = "commissioning" # enlistment |
87 | 585 | if configs["use_rack_proxy"]: | 606 | if configs["use_rack_proxy"]: |
88 | @@ -665,6 +686,7 @@ def get_config( | |||
89 | 665 | # As of MAAS 2.4 only HTTP boot is supported. This ensures MAAS 2.3 | 686 | # As of MAAS 2.4 only HTTP boot is supported. This ensures MAAS 2.3 |
90 | 666 | # rack controllers use HTTP boot as well. | 687 | # rack controllers use HTTP boot as well. |
91 | 667 | "http_boot": True, | 688 | "http_boot": True, |
92 | 689 | "ephemeral_opts": ephemeral_opts or "", | ||
93 | 668 | } | 690 | } |
94 | 669 | if machine is not None: | 691 | if machine is not None: |
95 | 670 | params["system_id"] = machine.system_id | 692 | params["system_id"] = machine.system_id |
96 | diff --git a/src/maasserver/rpc/tests/test_boot.py b/src/maasserver/rpc/tests/test_boot.py | |||
97 | index 9e1f972..6928a67 100644 | |||
98 | --- a/src/maasserver/rpc/tests/test_boot.py | |||
99 | +++ b/src/maasserver/rpc/tests/test_boot.py | |||
100 | @@ -235,6 +235,7 @@ class TestGetConfig(MAASServerTestCase): | |||
101 | 235 | "log_port": 5247, | 235 | "log_port": 5247, |
102 | 236 | "extra_opts": "", | 236 | "extra_opts": "", |
103 | 237 | "http_boot": True, | 237 | "http_boot": True, |
104 | 238 | "ephemeral_opts": "", | ||
105 | 238 | }, | 239 | }, |
106 | 239 | config, | 240 | config, |
107 | 240 | ) | 241 | ) |
108 | @@ -280,6 +281,7 @@ class TestGetConfig(MAASServerTestCase): | |||
109 | 280 | "log_port": syslog_port, | 281 | "log_port": syslog_port, |
110 | 281 | "extra_opts": "", | 282 | "extra_opts": "", |
111 | 282 | "http_boot": True, | 283 | "http_boot": True, |
112 | 284 | "ephemeral_opts": "", | ||
113 | 283 | }, | 285 | }, |
114 | 284 | config, | 286 | config, |
115 | 285 | ) | 287 | ) |
116 | @@ -324,6 +326,7 @@ class TestGetConfig(MAASServerTestCase): | |||
117 | 324 | "log_port": 5247, | 326 | "log_port": 5247, |
118 | 325 | "extra_opts": "", | 327 | "extra_opts": "", |
119 | 326 | "http_boot": True, | 328 | "http_boot": True, |
120 | 329 | "ephemeral_opts": "", | ||
121 | 327 | }, | 330 | }, |
122 | 328 | config, | 331 | config, |
123 | 329 | ) | 332 | ) |
124 | @@ -1356,6 +1359,7 @@ class TestGetConfig(MAASServerTestCase): | |||
125 | 1356 | rack_controller.system_id, local_ip, remote_ip, mac=mac | 1359 | rack_controller.system_id, local_ip, remote_ip, mac=mac |
126 | 1357 | ) | 1360 | ) |
127 | 1358 | self.assertEqual(distro_series, observed_config["release"]) | 1361 | self.assertEqual(distro_series, observed_config["release"]) |
128 | 1362 | self.assertEqual("", observed_config["ephemeral_opts"]) | ||
129 | 1359 | 1363 | ||
130 | 1360 | def test_returns_base_image_for_custom_ubuntu_image_xinstall(self): | 1364 | def test_returns_base_image_for_custom_ubuntu_image_xinstall(self): |
131 | 1361 | self.patch(boot_module, "get_boot_filenames").return_value = ( | 1365 | self.patch(boot_module, "get_boot_filenames").return_value = ( |
132 | @@ -1390,6 +1394,32 @@ class TestGetConfig(MAASServerTestCase): | |||
133 | 1390 | expected_osystem, expected_series = custom_image.base_image.split("/") | 1394 | expected_osystem, expected_series = custom_image.base_image.split("/") |
134 | 1391 | self.assertEqual(expected_osystem, observed_config["osystem"]) | 1395 | self.assertEqual(expected_osystem, observed_config["osystem"]) |
135 | 1392 | self.assertEqual(expected_series, observed_config["release"]) | 1396 | self.assertEqual(expected_series, observed_config["release"]) |
136 | 1397 | self.assertEqual("", observed_config["ephemeral_opts"]) | ||
137 | 1398 | |||
138 | 1399 | def test_returns_quirks_for_centos_image_xinstall(self): | ||
139 | 1400 | osystem = Config.objects.get_config("default_osystem") | ||
140 | 1401 | release = Config.objects.get_config("default_distro_series") | ||
141 | 1402 | rack_controller = factory.make_RackController() | ||
142 | 1403 | local_ip = factory.make_ip_address() | ||
143 | 1404 | remote_ip = factory.make_ip_address() | ||
144 | 1405 | self.make_node(arch_name="amd64") | ||
145 | 1406 | node = factory.make_Node_with_Interface_on_Subnet( | ||
146 | 1407 | status=NODE_STATUS.DEPLOYING, | ||
147 | 1408 | osystem="centos", | ||
148 | 1409 | distro_series="centos71", | ||
149 | 1410 | architecture="amd64/generic", | ||
150 | 1411 | primary_rack=rack_controller, | ||
151 | 1412 | ) | ||
152 | 1413 | mac = node.get_boot_interface().mac_address | ||
153 | 1414 | self.patch_autospec(boot_module, "event_log_pxe_request") | ||
154 | 1415 | observed_config = get_config( | ||
155 | 1416 | rack_controller.system_id, local_ip, remote_ip, mac=mac | ||
156 | 1417 | ) | ||
157 | 1418 | self.assertEqual(osystem, observed_config["osystem"]) | ||
158 | 1419 | self.assertEqual(release, observed_config["release"]) | ||
159 | 1420 | self.assertEqual( | ||
160 | 1421 | "nvme-core.multipath=0", observed_config["ephemeral_opts"] | ||
161 | 1422 | ) | ||
162 | 1393 | 1423 | ||
163 | 1394 | # XXX: roaksoax LP: #1739761 - Deploying precise is now done using | 1424 | # XXX: roaksoax LP: #1739761 - Deploying precise is now done using |
164 | 1395 | # the commissioning ephemeral environment. | 1425 | # the commissioning ephemeral environment. |
165 | @@ -1593,7 +1623,7 @@ class TestGetBootConfigForMachine(MAASServerTestCase): | |||
166 | 1593 | ] | 1623 | ] |
167 | 1594 | ) | 1624 | ) |
168 | 1595 | 1625 | ||
170 | 1596 | osystem, series, config_arch = get_boot_config_for_machine( | 1626 | osystem, series, config_arch, _, _ = get_boot_config_for_machine( |
171 | 1597 | machine, configs, "xinstall" | 1627 | machine, configs, "xinstall" |
172 | 1598 | ) | 1628 | ) |
173 | 1599 | 1629 | ||
174 | @@ -1634,7 +1664,7 @@ class TestGetBootConfigForMachine(MAASServerTestCase): | |||
175 | 1634 | ] | 1664 | ] |
176 | 1635 | ) | 1665 | ) |
177 | 1636 | 1666 | ||
179 | 1637 | osystem, series, config_arch = get_boot_config_for_machine( | 1667 | osystem, series, config_arch, _, _ = get_boot_config_for_machine( |
180 | 1638 | machine, configs, "xinstall" | 1668 | machine, configs, "xinstall" |
181 | 1639 | ) | 1669 | ) |
182 | 1640 | 1670 | ||
183 | @@ -1672,7 +1702,7 @@ class TestGetBootConfigForMachine(MAASServerTestCase): | |||
184 | 1672 | ] | 1702 | ] |
185 | 1673 | ) | 1703 | ) |
186 | 1674 | 1704 | ||
188 | 1675 | osystem, series, config_arch = get_boot_config_for_machine( | 1705 | osystem, series, config_arch, _, _ = get_boot_config_for_machine( |
189 | 1676 | machine, configs, "xinstall" | 1706 | machine, configs, "xinstall" |
190 | 1677 | ) | 1707 | ) |
191 | 1678 | 1708 | ||
192 | @@ -1737,7 +1767,7 @@ class TestGetBootConfigForMachine(MAASServerTestCase): | |||
193 | 1737 | architecture=f"amd64/{legacy_subarch}", | 1767 | architecture=f"amd64/{legacy_subarch}", |
194 | 1738 | ) | 1768 | ) |
195 | 1739 | 1769 | ||
197 | 1740 | osystem, series, config_arch = get_boot_config_for_machine( | 1770 | osystem, series, config_arch, _, _ = get_boot_config_for_machine( |
198 | 1741 | modern_machine, configs, "xinstall" | 1771 | modern_machine, configs, "xinstall" |
199 | 1742 | ) | 1772 | ) |
200 | 1743 | self.assertEqual("ubuntu", osystem) | 1773 | self.assertEqual("ubuntu", osystem) |
201 | @@ -1745,7 +1775,7 @@ class TestGetBootConfigForMachine(MAASServerTestCase): | |||
202 | 1745 | self.assertEqual(subarch, config_arch) | 1775 | self.assertEqual(subarch, config_arch) |
203 | 1746 | self.assertNotEqual(machine_hwe_kernel, config_arch) | 1776 | self.assertNotEqual(machine_hwe_kernel, config_arch) |
204 | 1747 | 1777 | ||
206 | 1748 | osystem, series, config_arch = get_boot_config_for_machine( | 1778 | osystem, series, config_arch, _, _ = get_boot_config_for_machine( |
207 | 1749 | legacy_machine, configs, "xinstall" | 1779 | legacy_machine, configs, "xinstall" |
208 | 1750 | ) | 1780 | ) |
209 | 1751 | self.assertEqual("ubuntu", osystem) | 1781 | self.assertEqual("ubuntu", osystem) |
210 | @@ -1796,7 +1826,7 @@ class TestGetBootConfigForMachine(MAASServerTestCase): | |||
211 | 1796 | architecture=f"amd64/{legacy_subarch}", | 1826 | architecture=f"amd64/{legacy_subarch}", |
212 | 1797 | ) | 1827 | ) |
213 | 1798 | 1828 | ||
215 | 1799 | osystem, series, config_arch = get_boot_config_for_machine( | 1829 | osystem, series, config_arch, _, _ = get_boot_config_for_machine( |
216 | 1800 | machine, configs, "commissioning" | 1830 | machine, configs, "commissioning" |
217 | 1801 | ) | 1831 | ) |
218 | 1802 | self.assertEqual(configs["commissioning_osystem"], osystem) | 1832 | self.assertEqual(configs["commissioning_osystem"], osystem) |
219 | @@ -1804,6 +1834,51 @@ class TestGetBootConfigForMachine(MAASServerTestCase): | |||
220 | 1804 | self.assertEqual(legacy_subarch, config_arch) | 1834 | self.assertEqual(legacy_subarch, config_arch) |
221 | 1805 | self.assertNotEqual(machine_hwe_kernel, config_arch) | 1835 | self.assertNotEqual(machine_hwe_kernel, config_arch) |
222 | 1806 | 1836 | ||
223 | 1837 | def test_get_boot_config_for_machine_centos(self): | ||
224 | 1838 | subarch = "ga-20.04" | ||
225 | 1839 | # We need a base image to be present. In fact, we always | ||
226 | 1840 | # needed that for the new image to boot. | ||
227 | 1841 | factory.make_default_ubuntu_release_bootable(arch=f"amd64/{subarch}") | ||
228 | 1842 | factory.make_usable_boot_resource( | ||
229 | 1843 | name="centos/7", | ||
230 | 1844 | architecture="amd64/generic", | ||
231 | 1845 | ) | ||
232 | 1846 | machine = factory.make_Machine( | ||
233 | 1847 | architecture="amd64/generic", | ||
234 | 1848 | status=NODE_STATUS.DEPLOYING, | ||
235 | 1849 | osystem="centos", | ||
236 | 1850 | distro_series="7", | ||
237 | 1851 | ) | ||
238 | 1852 | configs = Config.objects.get_configs( | ||
239 | 1853 | [ | ||
240 | 1854 | "commissioning_osystem", | ||
241 | 1855 | "commissioning_distro_series", | ||
242 | 1856 | "enable_third_party_drivers", | ||
243 | 1857 | "default_min_hwe_kernel", | ||
244 | 1858 | "default_osystem", | ||
245 | 1859 | "default_distro_series", | ||
246 | 1860 | "kernel_opts", | ||
247 | 1861 | "use_rack_proxy", | ||
248 | 1862 | "maas_internal_domain", | ||
249 | 1863 | "remote_syslog", | ||
250 | 1864 | "maas_syslog_port", | ||
251 | 1865 | ] | ||
252 | 1866 | ) | ||
253 | 1867 | |||
254 | 1868 | ( | ||
255 | 1869 | osystem, | ||
256 | 1870 | series, | ||
257 | 1871 | config_arch, | ||
258 | 1872 | final_osystem, | ||
259 | 1873 | final_series, | ||
260 | 1874 | ) = get_boot_config_for_machine(machine, configs, "xinstall") | ||
261 | 1875 | |||
262 | 1876 | self.assertEqual(configs["commissioning_osystem"], osystem) | ||
263 | 1877 | self.assertEqual(configs["commissioning_distro_series"], series) | ||
264 | 1878 | self.assertEqual(subarch, config_arch) | ||
265 | 1879 | self.assertEqual("centos", final_osystem) | ||
266 | 1880 | self.assertEqual("7", final_series) | ||
267 | 1881 | |||
268 | 1807 | 1882 | ||
269 | 1808 | class TestGetNodeFromMacOrHardwareUUID(MAASServerTestCase): | 1883 | class TestGetNodeFromMacOrHardwareUUID(MAASServerTestCase): |
270 | 1809 | def test_get_node_from_mac_or_hardware_uuid_with_regular_mac(self): | 1884 | def test_get_node_from_mac_or_hardware_uuid_with_regular_mac(self): |
271 | diff --git a/src/maasserver/rpc/tests/test_regionservice_calls.py b/src/maasserver/rpc/tests/test_regionservice_calls.py | |||
272 | index dbc756a..5a22f1b 100644 | |||
273 | --- a/src/maasserver/rpc/tests/test_regionservice_calls.py | |||
274 | +++ b/src/maasserver/rpc/tests/test_regionservice_calls.py | |||
275 | @@ -371,6 +371,7 @@ class TestRegionProtocol_GetBootConfig(MAASTransactionServerTestCase): | |||
276 | 371 | "fs_host", | 371 | "fs_host", |
277 | 372 | "log_host", | 372 | "log_host", |
278 | 373 | "extra_opts", | 373 | "extra_opts", |
279 | 374 | "ephemeral_opts", | ||
280 | 374 | ] | 375 | ] |
281 | 375 | ), | 376 | ), |
282 | 376 | ) | 377 | ) |
283 | diff --git a/src/provisioningserver/kernel_opts.py b/src/provisioningserver/kernel_opts.py | |||
284 | index b0da4a0..56f3add 100644 | |||
285 | --- a/src/provisioningserver/kernel_opts.py | |||
286 | +++ b/src/provisioningserver/kernel_opts.py | |||
287 | @@ -44,6 +44,7 @@ KernelParametersBase = namedtuple( | |||
288 | 44 | # verbatim to the kernel command line | 44 | # verbatim to the kernel command line |
289 | 45 | "http_boot", # Used to make sure a MAAS 2.3 rack controller uses | 45 | "http_boot", # Used to make sure a MAAS 2.3 rack controller uses |
290 | 46 | # http_boot. | 46 | # http_boot. |
291 | 47 | "ephemeral_opts", # Same as 'extra_opts' but used only in the ephemeral OS | ||
292 | 47 | ), | 48 | ), |
293 | 48 | ) | 49 | ) |
294 | 49 | 50 | ||
295 | @@ -162,6 +163,8 @@ def compose_kernel_command_line(params): | |||
296 | 162 | # as it would be nice to have. | 163 | # as it would be nice to have. |
297 | 163 | options += compose_logging_opts(params) | 164 | options += compose_logging_opts(params) |
298 | 164 | options += compose_arch_opts(params) | 165 | options += compose_arch_opts(params) |
299 | 166 | if params.ephemeral_opts: | ||
300 | 167 | options.append(params.ephemeral_opts) | ||
301 | 165 | cmdline_sep = get_curtin_kernel_cmdline_sep() | 168 | cmdline_sep = get_curtin_kernel_cmdline_sep() |
302 | 166 | if params.extra_opts: | 169 | if params.extra_opts: |
303 | 167 | # Using --- before extra opts makes both d-i and Curtin install | 170 | # Using --- before extra opts makes both d-i and Curtin install |
304 | diff --git a/src/provisioningserver/rpc/region.py b/src/provisioningserver/rpc/region.py | |||
305 | index 6c8ba93..779949b 100644 | |||
306 | --- a/src/provisioningserver/rpc/region.py | |||
307 | +++ b/src/provisioningserver/rpc/region.py | |||
308 | @@ -154,6 +154,7 @@ class GetBootConfig(amp.Command): | |||
309 | 154 | # will try to use TGT as Twisted sets optional parameters to False when | 154 | # will try to use TGT as Twisted sets optional parameters to False when |
310 | 155 | # not defined. | 155 | # not defined. |
311 | 156 | (b"http_boot", amp.Boolean(optional=True)), | 156 | (b"http_boot", amp.Boolean(optional=True)), |
312 | 157 | (b"ephemeral_opts", amp.Unicode(optional=True)), | ||
313 | 157 | ] | 158 | ] |
314 | 158 | errors = {BootConfigNoResponse: b"BootConfigNoResponse"} | 159 | errors = {BootConfigNoResponse: b"BootConfigNoResponse"} |
315 | 159 | 160 | ||
316 | diff --git a/src/provisioningserver/tests/test_kernel_opts.py b/src/provisioningserver/tests/test_kernel_opts.py | |||
317 | index 396aa4e..7e62449 100644 | |||
318 | --- a/src/provisioningserver/tests/test_kernel_opts.py | |||
319 | +++ b/src/provisioningserver/tests/test_kernel_opts.py | |||
320 | @@ -467,3 +467,20 @@ class TestKernelOpts(MAASTestCase): | |||
321 | 467 | ] | 467 | ] |
322 | 468 | ), | 468 | ), |
323 | 469 | ) | 469 | ) |
324 | 470 | |||
325 | 471 | def test_xinstall_compose_kernel_command_line_ephemeral_opts(self): | ||
326 | 472 | # ephemeral opts MUST appear before the separator | ||
327 | 473 | mock_get_curtin_sep = self.patch( | ||
328 | 474 | kernel_opts, "get_curtin_kernel_cmdline_sep" | ||
329 | 475 | ) | ||
330 | 476 | sep = factory.make_name("sep") | ||
331 | 477 | mock_get_curtin_sep.return_value = sep | ||
332 | 478 | |||
333 | 479 | ephem_opt = "EPHEMERAL_OPT=1" | ||
334 | 480 | params = self.make_kernel_parameters( | ||
335 | 481 | purpose="xinstall", | ||
336 | 482 | ephemeral_opts=ephem_opt, | ||
337 | 483 | ) | ||
338 | 484 | cmdline = compose_kernel_command_line(params) | ||
339 | 485 | self.assertIn(ephem_opt, cmdline) | ||
340 | 486 | self.assertTrue(cmdline.find(sep) > cmdline.find(ephem_opt)) |
UNIT TESTS
-b lp1914812_to_3_4 lp:~alexsander-souza/maas/+git/maas into -b 3.4 lp:~maas-committers/maas
STATUS: SUCCESS e8d58c4ec6bbc89 94df263194
COMMIT: 820b74b82723396