Merge lp:~blake-rouse/maas/fix-1384778-1.7 into lp:maas/1.7

Proposed by Blake Rouse
Status: Merged
Approved by: Blake Rouse
Approved revision: no longer in the source branch.
Merged at revision: 3279
Proposed branch: lp:~blake-rouse/maas/fix-1384778-1.7
Merge into: lp:maas/1.7
Diff against target: 44 lines (+24/-0)
2 files modified
src/maasserver/rpc/nodes.py (+6/-0)
src/maasserver/rpc/tests/test_nodes.py (+18/-0)
To merge this branch: bzr merge lp:~blake-rouse/maas/fix-1384778-1.7
Reviewer Review Type Date Requested Status
Christian Reis (community) Approve
Julian Edwards (community) Approve
Review via email: mp+239525@code.launchpad.net

Commit message

Handle missing subarchitecture on CreateNode RPC call.

Description of the change

Merged into trunk here: https://code.launchpad.net/~blake-rouse/maas/fix-1384778/+merge/239489

Required or probe-and-enlist is broken.

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) :
review: Approve
Revision history for this message
Christian Reis (kiko) wrote :

I'd like to have seen a test that ensures the wider functional problem is solved. I guess that's not easy to do?

At any rate, the code is safe for 1.7.

review: Approve
Revision history for this message
Blake Rouse (blake-rouse) wrote :

Its not that its not easy. It just that multiple drivers on the cluster call the CreateNode RPC call, and the actual call on the region is patched out.

The based way to test this is to start testing probe-and-enlist in CI. That would have found this issue immediately. But that also means placing a sm15k in CI.

Revision history for this message
Christian Reis (kiko) wrote :

Could we do a fake or ultra-simple 1-node probe-and-enlist using, say IPMI, and if so, would that have caught the bug?

Revision history for this message
Blake Rouse (blake-rouse) wrote :

Overall that would do very little, as each power driver can call CreateNode RPC differently.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/rpc/nodes.py'
2--- src/maasserver/rpc/nodes.py 2014-09-27 04:25:55 +0000
3+++ src/maasserver/rpc/nodes.py 2014-10-24 01:08:05 +0000
4@@ -122,6 +122,12 @@
5 raise NodeAlreadyExists(
6 "One of the MACs %s is already in use by a node." %
7 mac_addresses)
8+
9+ # It is possible that the enlistment code did not provide a subarchitecture
10+ # for the give architecture; assume 'generic'.
11+ if '/' not in architecture:
12+ architecture = '%s/generic' % architecture
13+
14 cluster = NodeGroup.objects.get_by_natural_key(cluster_uuid)
15 data = {
16 'power_type': power_type,
17
18=== modified file 'src/maasserver/rpc/tests/test_nodes.py'
19--- src/maasserver/rpc/tests/test_nodes.py 2014-10-09 16:22:36 +0000
20+++ src/maasserver/rpc/tests/test_nodes.py 2014-10-24 01:08:05 +0000
21@@ -140,6 +140,24 @@
22 node = reload_object(node)
23 self.assertEqual(power_parameters, node.power_parameters)
24
25+ def test__forces_generic_subarchitecture_if_missing(self):
26+ cluster = factory.make_NodeGroup()
27+ cluster.accept()
28+ self.prepare_cluster_rpc(cluster)
29+
30+ mac_addresses = [
31+ factory.make_mac_address() for _ in range(3)]
32+ architecture = make_usable_architecture(self, subarch_name='generic')
33+ power_type = random.choice(self.power_types)['name']
34+ power_parameters = dumps({})
35+
36+ arch, subarch = architecture.split('/')
37+ node = create_node(
38+ cluster.uuid, arch, power_type, power_parameters,
39+ mac_addresses)
40+
41+ self.assertEqual(architecture, node.architecture)
42+
43
44 class TestMarkNodeFailed(MAASServerTestCase):
45

Subscribers

People subscribed via source and target branches

to all changes: