launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #14064
[Merge] lp:~jameinel/maas/1.2-expose-kernel-opts-on-tag into lp:maas/1.2
John A Meinel has proposed merging lp:~jameinel/maas/1.2-expose-kernel-opts-on-tag into lp:maas/1.2 with lp:~jameinel/maas/1.2-kernel-option-tags as a prerequisite.
Commit message:
Expose kernel_opts as part of the Tag api's
This lets you set the options and query them in the API, and document how they work.
Requested reviews:
MAAS Maintainers (maas-maintainers)
For more details, see:
https://code.launchpad.net/~jameinel/maas/1.2-expose-kernel-opts-on-tag/+merge/133241
I imagine there is more documentation that needs tweaking, since we'll now need a whole section about setting kernel options, and how that will interact with tags, etc. But at least this should be a reasonable start.
--
https://code.launchpad.net/~jameinel/maas/1.2-expose-kernel-opts-on-tag/+merge/133241
Your team MAAS Maintainers is requested to review the proposed merge of lp:~jameinel/maas/1.2-expose-kernel-opts-on-tag into lp:maas/1.2.
=== modified file 'src/maasserver/api.py'
--- src/maasserver/api.py 2012-11-02 09:48:02 +0000
+++ src/maasserver/api.py 2012-11-07 13:36:26 +0000
@@ -1420,6 +1420,7 @@
'name',
'definition',
'comment',
+ 'kernel_opts',
)
def read(self, request, name):
@@ -1540,6 +1541,11 @@
It is meant as a human readable description of the tag.
:param definition: An XPATH query that will be evaluated against the
hardware_details stored for all nodes (output of `lshw -xml`).
+ :param kernel_opts: Can be None. If set, nodes associated with this tag
+ will add this string to their kernel options when booting. The
+ value overrides the global 'kernel_opts' setting. If more than one
+ tag is associated with a node, the one with the lowest alphabetical
+ name will be picked (eg 01-my-tag will be taken over 99-tag-name).
"""
if not request.user.is_superuser:
raise PermissionDenied()
=== modified file 'src/maasserver/forms.py'
--- src/maasserver/forms.py 2012-11-06 18:19:54 +0000
+++ src/maasserver/forms.py 2012-11-07 13:36:26 +0000
@@ -855,6 +855,7 @@
'name',
'comment',
'definition',
+ 'kernel_opts',
)
def clean_definition(self):
=== modified file 'src/maasserver/tests/test_api.py'
--- src/maasserver/tests/test_api.py 2012-11-06 18:19:54 +0000
+++ src/maasserver/tests/test_api.py 2012-11-07 13:36:26 +0000
@@ -2999,6 +2999,30 @@
% (invalid,))
self.assertFalse(Tag.objects.filter(name=invalid).exists())
+ def test_POST_new_kernel_opts(self):
+ self.become_admin()
+ name = factory.getRandomString()
+ definition = '//node'
+ comment = factory.getRandomString()
+ kernel_opts = factory.getRandomString()
+ response = self.client.post(
+ self.get_uri('tags/'),
+ {
+ 'op': 'new',
+ 'name': name,
+ 'comment': comment,
+ 'definition': definition,
+ 'kernel_opts': kernel_opts,
+ })
+ self.assertEqual(httplib.OK, response.status_code)
+ parsed_result = json.loads(response.content)
+ self.assertEqual(name, parsed_result['name'])
+ self.assertEqual(comment, parsed_result['comment'])
+ self.assertEqual(definition, parsed_result['definition'])
+ self.assertEqual(kernel_opts, parsed_result['kernel_opts'])
+ self.assertEqual(
+ kernel_opts, Tag.objects.filter(name=name)[0].kernel_opts)
+
def test_POST_new_populates_nodes(self):
self.become_admin()
node1 = factory.make_node()
Follow ups