← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~racb/maas/arm_kernel_parameters into lp:maas

 

Robie Basak has proposed merging lp:~racb/maas/arm_kernel_parameters into lp:maas.

Requested reviews:
  MAAS Maintainers (maas-maintainers)

For more details, see:
https://code.launchpad.net/~racb/maas/arm_kernel_parameters/+merge/122241


-- 
https://code.launchpad.net/~racb/maas/arm_kernel_parameters/+merge/122241
Your team MAAS Maintainers is requested to review the proposed merge of lp:~racb/maas/arm_kernel_parameters into lp:maas.
=== modified file 'src/provisioningserver/kernel_opts.py'
--- src/provisioningserver/kernel_opts.py	2012-08-24 00:04:58 +0000
+++ src/provisioningserver/kernel_opts.py	2012-08-31 11:10:22 +0000
@@ -142,6 +142,14 @@
             ]
 
 
+def compose_arch_opts(params):
+    """Return any architecture-specific options required"""
+    if (params.arch, params.subarch) == ("armhf", "highbank"):
+        return [ "console=ttyAMA0" ]
+    else:
+        return []
+
+
 def compose_kernel_command_line_new(params):
     """Generate a line of kernel options for booting `node`.
 
@@ -159,4 +167,5 @@
         ]
     options += compose_purpose_opts(params)
     options += compose_logging_opts(params.log_host)
+    options += compose_arch_opts(params)
     return ' '.join(options)

=== modified file 'src/provisioningserver/tests/test_kernel_opts.py'
--- src/provisioningserver/tests/test_kernel_opts.py	2012-08-24 00:03:33 +0000
+++ src/provisioningserver/tests/test_kernel_opts.py	2012-08-31 11:10:22 +0000
@@ -29,6 +29,10 @@
     )
 from provisioningserver.pxe.tftppath import compose_image_path
 from provisioningserver.testing.config import ConfigFixture
+from testtools.matchers import (
+    Contains,
+    Not,
+    )
 
 
 def make_kernel_parameters():
@@ -170,3 +174,17 @@
         self.assertEqual(
             "auto url=%s" % dummy_preseed_url,
             compose_preseed_opt(dummy_preseed_url))
+
+    def test_compose_kernel_command_line_inc_arm_specific_option(self):
+        params = make_kernel_parameters()
+        params = params._replace(arch="armhf", subarch="highbank")
+        self.assertThat(
+            compose_kernel_command_line_new(params),
+            Contains("console=ttyAMA0"))
+
+    def test_compose_kernel_command_line_not_inc_arm_specific_option(self):
+        params = make_kernel_parameters()
+        params = params._replace(arch="i386")
+        self.assertThat(
+            compose_kernel_command_line_new(params),
+            Not(Contains("console=ttyAMA0")))