Merge lp:~jameinel/maas/1.2-node-get-effective-kernel-options into lp:maas/1.2

Proposed by John A Meinel
Status: Merged
Approved by: John A Meinel
Approved revision: 1285
Merged at revision: 1287
Proposed branch: lp:~jameinel/maas/1.2-node-get-effective-kernel-options
Merge into: lp:maas/1.2
Diff against target: 44 lines (+23/-0)
2 files modified
src/maasserver/models/node.py (+12/-0)
src/maasserver/tests/test_node.py (+11/-0)
To merge this branch: bzr merge lp:~jameinel/maas/1.2-node-get-effective-kernel-options
Reviewer Review Type Date Requested Status
Martin Packman (community) Approve
Review via email: mp+133205@code.launchpad.net

Commit message

Add Node.get_effective_kernel_options.

The first implementation only reads the global setting. Ones handling tags will come later.

Description of the change

This just provides the internal method, so that Dimiter can use it to continue forward on the UI level changes.

The next follow up will merge Martin's pending DB change, and expose values from tags.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Looks good. Worth noting, is that if the first tuple item is not None, the second must be a string, as we should only match tags that have kernel parameters.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/models/node.py'
2--- src/maasserver/models/node.py 2012-10-30 15:11:10 +0000
3+++ src/maasserver/models/node.py 2012-11-07 10:24:21 +0000
4@@ -694,6 +694,18 @@
5 else:
6 return None
7
8+ def get_effective_kernel_options(self):
9+ """Determine any special kernel parameters for this node.
10+
11+ :return: (tag, kernel_options)
12+ tag is a Tag object or None. If None, the kernel_options came from
13+ the global setting.
14+ kernel_options, a string or None indicating extra kernel_options
15+ that should be used when booting this node.
16+ """
17+ global_value = Config.objects.get_config('kernel_opts')
18+ return None, global_value
19+
20 @property
21 def work_queue(self):
22 """The name of the queue for tasks specific to this node."""
23
24=== modified file 'src/maasserver/tests/test_node.py'
25--- src/maasserver/tests/test_node.py 2012-10-30 15:11:10 +0000
26+++ src/maasserver/tests/test_node.py 2012-11-07 10:24:21 +0000
27@@ -303,6 +303,17 @@
28 successful_types = [node_power_types[node] for node in started_nodes]
29 self.assertItemsEqual(configless_power_types, successful_types)
30
31+ def test_get_effective_kernel_options_with_nothing_set(self):
32+ node = factory.make_node()
33+ self.assertEqual((None, None), node.get_effective_kernel_options())
34+
35+ def test_get_effective_kernel_options_sees_global_config(self):
36+ node = factory.make_node()
37+ kernel_opts = factory.getRandomString()
38+ Config.objects.set_config('kernel_opts', kernel_opts)
39+ self.assertEqual(
40+ (None, kernel_opts), node.get_effective_kernel_options())
41+
42 def test_acquire(self):
43 node = factory.make_node(status=NODE_STATUS.READY)
44 user = factory.make_user()

Subscribers

People subscribed via source and target branches

to status/vote changes: