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: no longer in the source branch.
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
=== modified file 'src/maasserver/models/node.py'
--- src/maasserver/models/node.py 2012-10-30 15:11:10 +0000
+++ src/maasserver/models/node.py 2012-11-07 10:24:21 +0000
@@ -694,6 +694,18 @@
694 else:694 else:
695 return None695 return None
696696
697 def get_effective_kernel_options(self):
698 """Determine any special kernel parameters for this node.
699
700 :return: (tag, kernel_options)
701 tag is a Tag object or None. If None, the kernel_options came from
702 the global setting.
703 kernel_options, a string or None indicating extra kernel_options
704 that should be used when booting this node.
705 """
706 global_value = Config.objects.get_config('kernel_opts')
707 return None, global_value
708
697 @property709 @property
698 def work_queue(self):710 def work_queue(self):
699 """The name of the queue for tasks specific to this node."""711 """The name of the queue for tasks specific to this node."""
700712
=== modified file 'src/maasserver/tests/test_node.py'
--- src/maasserver/tests/test_node.py 2012-10-30 15:11:10 +0000
+++ src/maasserver/tests/test_node.py 2012-11-07 10:24:21 +0000
@@ -303,6 +303,17 @@
303 successful_types = [node_power_types[node] for node in started_nodes]303 successful_types = [node_power_types[node] for node in started_nodes]
304 self.assertItemsEqual(configless_power_types, successful_types)304 self.assertItemsEqual(configless_power_types, successful_types)
305305
306 def test_get_effective_kernel_options_with_nothing_set(self):
307 node = factory.make_node()
308 self.assertEqual((None, None), node.get_effective_kernel_options())
309
310 def test_get_effective_kernel_options_sees_global_config(self):
311 node = factory.make_node()
312 kernel_opts = factory.getRandomString()
313 Config.objects.set_config('kernel_opts', kernel_opts)
314 self.assertEqual(
315 (None, kernel_opts), node.get_effective_kernel_options())
316
306 def test_acquire(self):317 def test_acquire(self):
307 node = factory.make_node(status=NODE_STATUS.READY)318 node = factory.make_node(status=NODE_STATUS.READY)
308 user = factory.make_user()319 user = factory.make_user()

Subscribers

People subscribed via source and target branches

to status/vote changes: