Merge lp:~cerberus/nova/lp820094 into lp:~hudson-openstack/nova/trunk

Proposed by Matt Dietz
Status: Merged
Approved by: Rick Harris
Approved revision: 1361
Merged at revision: 1361
Proposed branch: lp:~cerberus/nova/lp820094
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 148 lines (+7/-31)
3 files modified
nova/api/openstack/create_instance_helper.py (+1/-1)
nova/api/openstack/servers.py (+6/-6)
nova/tests/api/openstack/test_servers.py (+0/-24)
To merge this branch: bzr merge lp:~cerberus/nova/lp820094
Reviewer Review Type Date Requested Status
Rick Harris (community) Approve
Josh Kearney (community) Approve
Review via email: mp+70338@code.launchpad.net

Description of the change

Removes extraneous bodies from certain actions in the OSAPI servers controller

Requires the latest version of python-novaclient to test

To post a comment you must log in.
Revision history for this message
Josh Kearney (jk0) wrote :

LGTM!

review: Approve
Revision history for this message
Rick Harris (rconradharris) wrote :

lgtm.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/api/openstack/create_instance_helper.py'
2--- nova/api/openstack/create_instance_helper.py 2011-08-02 22:57:24 +0000
3+++ nova/api/openstack/create_instance_helper.py 2011-08-03 17:37:44 +0000
4@@ -92,7 +92,7 @@
5 image_href = self.controller._image_ref_from_req_data(body)
6 # If the image href was generated by nova api, strip image_href
7 # down to an id and use the default glance connection params
8-
9+
10 if str(image_href).startswith(req.application_url):
11 image_href = image_href.split('/').pop()
12 try:
13
14=== modified file 'nova/api/openstack/servers.py'
15--- nova/api/openstack/servers.py 2011-08-02 20:23:12 +0000
16+++ nova/api/openstack/servers.py 2011-08-03 17:37:44 +0000
17@@ -328,7 +328,7 @@
18 return webob.Response(status_int=202)
19
20 @scheduler_api.redirect_handler
21- def reset_network(self, req, id, body):
22+ def reset_network(self, req, id):
23 """
24 Reset networking on an instance (admin only).
25
26@@ -343,7 +343,7 @@
27 return webob.Response(status_int=202)
28
29 @scheduler_api.redirect_handler
30- def inject_network_info(self, req, id, body):
31+ def inject_network_info(self, req, id):
32 """
33 Inject network info for an instance (admin only).
34
35@@ -358,7 +358,7 @@
36 return webob.Response(status_int=202)
37
38 @scheduler_api.redirect_handler
39- def pause(self, req, id, body):
40+ def pause(self, req, id):
41 """ Permit Admins to Pause the server. """
42 ctxt = req.environ['nova.context']
43 try:
44@@ -370,7 +370,7 @@
45 return webob.Response(status_int=202)
46
47 @scheduler_api.redirect_handler
48- def unpause(self, req, id, body):
49+ def unpause(self, req, id):
50 """ Permit Admins to Unpause the server. """
51 ctxt = req.environ['nova.context']
52 try:
53@@ -382,7 +382,7 @@
54 return webob.Response(status_int=202)
55
56 @scheduler_api.redirect_handler
57- def suspend(self, req, id, body):
58+ def suspend(self, req, id):
59 """permit admins to suspend the server"""
60 context = req.environ['nova.context']
61 try:
62@@ -394,7 +394,7 @@
63 return webob.Response(status_int=202)
64
65 @scheduler_api.redirect_handler
66- def resume(self, req, id, body):
67+ def resume(self, req, id):
68 """permit admins to resume the server from suspend"""
69 context = req.environ['nova.context']
70 try:
71
72=== modified file 'nova/tests/api/openstack/test_servers.py'
73--- nova/tests/api/openstack/test_servers.py 2011-08-02 23:31:14 +0000
74+++ nova/tests/api/openstack/test_servers.py 2011-08-03 17:37:44 +0000
75@@ -1756,74 +1756,50 @@
76
77 def test_server_pause(self):
78 self.flags(allow_admin_api=True)
79- body = dict(server=dict(
80- name='server_test', imageId=2, flavorId=2, metadata={},
81- personality={}))
82 req = webob.Request.blank('/v1.0/servers/1/pause')
83 req.method = 'POST'
84 req.content_type = 'application/json'
85- req.body = json.dumps(body)
86 res = req.get_response(fakes.wsgi_app())
87 self.assertEqual(res.status_int, 202)
88
89 def test_server_unpause(self):
90 self.flags(allow_admin_api=True)
91- body = dict(server=dict(
92- name='server_test', imageId=2, flavorId=2, metadata={},
93- personality={}))
94 req = webob.Request.blank('/v1.0/servers/1/unpause')
95 req.method = 'POST'
96 req.content_type = 'application/json'
97- req.body = json.dumps(body)
98 res = req.get_response(fakes.wsgi_app())
99 self.assertEqual(res.status_int, 202)
100
101 def test_server_suspend(self):
102 self.flags(allow_admin_api=True)
103- body = dict(server=dict(
104- name='server_test', imageId=2, flavorId=2, metadata={},
105- personality={}))
106 req = webob.Request.blank('/v1.0/servers/1/suspend')
107 req.method = 'POST'
108 req.content_type = 'application/json'
109- req.body = json.dumps(body)
110 res = req.get_response(fakes.wsgi_app())
111 self.assertEqual(res.status_int, 202)
112
113 def test_server_resume(self):
114 self.flags(allow_admin_api=True)
115- body = dict(server=dict(
116- name='server_test', imageId=2, flavorId=2, metadata={},
117- personality={}))
118 req = webob.Request.blank('/v1.0/servers/1/resume')
119 req.method = 'POST'
120 req.content_type = 'application/json'
121- req.body = json.dumps(body)
122 res = req.get_response(fakes.wsgi_app())
123 self.assertEqual(res.status_int, 202)
124
125 def test_server_reset_network(self):
126 self.flags(allow_admin_api=True)
127- body = dict(server=dict(
128- name='server_test', imageId=2, flavorId=2, metadata={},
129- personality={}))
130 req = webob.Request.blank('/v1.0/servers/1/reset_network')
131 req.method = 'POST'
132 req.content_type = 'application/json'
133- req.body = json.dumps(body)
134 res = req.get_response(fakes.wsgi_app())
135 self.assertEqual(res.status_int, 202)
136
137 def test_server_inject_network_info(self):
138 self.flags(allow_admin_api=True)
139- body = dict(server=dict(
140- name='server_test', imageId=2, flavorId=2, metadata={},
141- personality={}))
142 req = webob.Request.blank(
143 '/v1.0/servers/1/inject_network_info')
144 req.method = 'POST'
145 req.content_type = 'application/json'
146- req.body = json.dumps(body)
147 res = req.get_response(fakes.wsgi_app())
148 self.assertEqual(res.status_int, 202)
149