launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #10629
[Merge] lp:~rvb/maas/more-kernel-options into lp:maas
Raphaël Badin has proposed merging lp:~rvb/maas/more-kernel-options into lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~rvb/maas/more-kernel-options/+merge/118396
This branch adds the "purpose options". I.e. the options which depends on the purpose ("commissioning", etc.).
This is a tiny branch but obviously, the meat will be in the follow-up branch, which adds a real `get_ephemeral_name`.
--
https://code.launchpad.net/~rvb/maas/more-kernel-options/+merge/118396
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/maas/more-kernel-options into lp:maas.
=== modified file 'src/maasserver/kernel_opts.py'
--- src/maasserver/kernel_opts.py 2012-08-06 14:08:04 +0000
+++ src/maasserver/kernel_opts.py 2012-08-06 17:00:27 +0000
@@ -86,6 +86,28 @@
]
+def get_ephemeral_name(release, arch):
+ # TODO: do something real here.
+ return "maas-precise-12.04-i386-ephemeral-20120424"
+
+
+def compose_purpose_opts(release, arch, purpose):
+ if purpose == "commissioning":
+ target_name_prefix = "iqn.2004-05.com.ubuntu:maas"
+ return [
+ "iscsi_target_name=%s:%s" % (
+ target_name_prefix, get_ephemeral_name(release, arch)),
+ "ip=dhcp",
+ "ro root=LABEL=cloudimg-rootfs",
+ "iscsi_target_ip=%s" % get_maas_facing_server_address(),
+ "iscsi_target_port=3260",
+ ]
+ else:
+ return [
+ "netcfg/choose_interface=auto"
+ ]
+
+
def compose_kernel_command_line(node, arch, subarch, purpose):
"""Generate a line of kernel options for booting `node`.
@@ -104,5 +126,6 @@
compose_domain_opt(node),
compose_locale_opt(),
]
+ options += compose_purpose_opts(release, arch, purpose)
options += compose_logging_opts()
return ' '.join(options)
=== modified file 'src/maasserver/tests/test_kernel_opts.py'
--- src/maasserver/tests/test_kernel_opts.py 2012-08-06 14:08:04 +0000
+++ src/maasserver/tests/test_kernel_opts.py 2012-08-06 17:00:27 +0000
@@ -22,6 +22,7 @@
compose_preseed_opt,
compose_preseed_url,
)
+from maasserver.server_address import get_maas_facing_server_address
from maasserver.preseed import (
get_enlist_preseed,
get_preseed,
@@ -120,6 +121,31 @@
"text priority=%s" % text_priority,
]))
+ def test_compose_kernel_command_line_inc_purpose_opts(self):
+ # The result of compose_kernel_command_line includes the purpose
+ # options for a non "commissioning" node.
+ self.assertIn(
+ "netcfg/choose_interface=auto",
+ compose_kernel_command_line(
+ None, factory.make_name('arch'),
+ factory.make_name('subarch'),
+ purpose=factory.make_name('purpose')))
+
+ def test_compose_kernel_command_line_inc_purpose_opts_comm_node(self):
+ # The result of compose_kernel_command_line includes the purpose
+ # options for a "commissioning" node.
+ node = factory.make_node()
+ self.assertThat(
+ compose_kernel_command_line(
+ node, factory.make_name('arch'),
+ factory.make_name('subarch'),
+ purpose="commissioning"),
+ ContainsAll([
+ "iscsi_target_name=iqn.2004-05.com.ubuntu:maas",
+ "iscsi_target_port=3260",
+ "iscsi_target_ip=%s" % get_maas_facing_server_address(),
+ ]))
+
def test_compose_enlistment_preseed_url_links_to_enlistment_preseed(self):
response = self.client.get(compose_enlistment_preseed_url())
self.assertEqual(