Merge lp:~gz/pyjuju/os_scheduler_hints_json_fix into lp:pyjuju

Proposed by Martin Packman
Status: Merged
Approved by: Kapil Thangavelu
Approved revision: 617
Merged at revision: 617
Proposed branch: lp:~gz/pyjuju/os_scheduler_hints_json_fix
Merge into: lp:pyjuju
Diff against target: 37 lines (+6/-4)
2 files modified
juju/providers/openstack/client.py (+3/-2)
juju/providers/openstack/tests/test_client.py (+3/-2)
To merge this branch: bzr merge lp:~gz/pyjuju/os_scheduler_hints_json_fix
Reviewer Review Type Date Requested Status
Kapil Thangavelu (community) Approve
John A Meinel Approve
Review via email: mp+149028@code.launchpad.net

Description of the change

Fix format of the scheduler hints passed in the json dict when creating a server.

This is the juju part of getting hints working, see the mailing list post:

<https://lists.ubuntu.com/archives/juju/2013-February/002112.html>

There is some discussion about designing a neater abstraction, this is just fixing the existing code in the interim.

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

Matches my understanding of how this should work.

review: Approve
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'juju/providers/openstack/client.py'
2--- juju/providers/openstack/client.py 2013-01-06 17:44:45 +0000
3+++ juju/providers/openstack/client.py 2013-02-18 11:45:27 +0000
4@@ -397,14 +397,15 @@
5 'flavorRef': flavor_id,
6 'imageRef': image_id,
7 }
8+ post_dict = {"server": server}
9 if user_data is not None:
10 server["user_data"] = base64.b64encode(user_data)
11 if security_group_names is not None:
12 server["security_groups"] = [{'name': n}
13 for n in security_group_names]
14 if scheduler_hints is not None:
15- server["OS-SCH-HNT:scheduler_hints"] = scheduler_hints
16- return self.post(["servers"], {'server': server},
17+ post_dict["OS-SCH-HNT:scheduler_hints"] = scheduler_hints
18+ return self.post(["servers"], post_dict,
19 root="server", code=202)
20
21 def get_server_security_groups(self, server_id):
22
23=== modified file 'juju/providers/openstack/tests/test_client.py'
24--- juju/providers/openstack/tests/test_client.py 2012-10-26 14:52:35 +0000
25+++ juju/providers/openstack/tests/test_client.py 2013-02-18 11:45:27 +0000
26@@ -204,8 +204,9 @@
27 "imageRef": "an-image",
28 "flavorRef": "a-flavor",
29 "name": "Test",
30- "OS-SCH-HNT:scheduler_hints": {"hint-key": "hint-val"},
31- }}, obj)
32+ },
33+ "OS-SCH-HNT:scheduler_hints": {"hint-key": "hint-val"},
34+ }, obj)
35 return True
36
37 @defer.inlineCallbacks

Subscribers

People subscribed via source and target branches

to status/vote changes: