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
=== modified file 'nova/api/openstack/create_instance_helper.py'
--- nova/api/openstack/create_instance_helper.py 2011-08-02 22:57:24 +0000
+++ nova/api/openstack/create_instance_helper.py 2011-08-03 17:37:44 +0000
@@ -92,7 +92,7 @@
92 image_href = self.controller._image_ref_from_req_data(body)92 image_href = self.controller._image_ref_from_req_data(body)
93 # If the image href was generated by nova api, strip image_href93 # If the image href was generated by nova api, strip image_href
94 # down to an id and use the default glance connection params94 # down to an id and use the default glance connection params
95 95
96 if str(image_href).startswith(req.application_url):96 if str(image_href).startswith(req.application_url):
97 image_href = image_href.split('/').pop()97 image_href = image_href.split('/').pop()
98 try:98 try:
9999
=== modified file 'nova/api/openstack/servers.py'
--- nova/api/openstack/servers.py 2011-08-02 20:23:12 +0000
+++ nova/api/openstack/servers.py 2011-08-03 17:37:44 +0000
@@ -328,7 +328,7 @@
328 return webob.Response(status_int=202)328 return webob.Response(status_int=202)
329329
330 @scheduler_api.redirect_handler330 @scheduler_api.redirect_handler
331 def reset_network(self, req, id, body):331 def reset_network(self, req, id):
332 """332 """
333 Reset networking on an instance (admin only).333 Reset networking on an instance (admin only).
334334
@@ -343,7 +343,7 @@
343 return webob.Response(status_int=202)343 return webob.Response(status_int=202)
344344
345 @scheduler_api.redirect_handler345 @scheduler_api.redirect_handler
346 def inject_network_info(self, req, id, body):346 def inject_network_info(self, req, id):
347 """347 """
348 Inject network info for an instance (admin only).348 Inject network info for an instance (admin only).
349349
@@ -358,7 +358,7 @@
358 return webob.Response(status_int=202)358 return webob.Response(status_int=202)
359359
360 @scheduler_api.redirect_handler360 @scheduler_api.redirect_handler
361 def pause(self, req, id, body):361 def pause(self, req, id):
362 """ Permit Admins to Pause the server. """362 """ Permit Admins to Pause the server. """
363 ctxt = req.environ['nova.context']363 ctxt = req.environ['nova.context']
364 try:364 try:
@@ -370,7 +370,7 @@
370 return webob.Response(status_int=202)370 return webob.Response(status_int=202)
371371
372 @scheduler_api.redirect_handler372 @scheduler_api.redirect_handler
373 def unpause(self, req, id, body):373 def unpause(self, req, id):
374 """ Permit Admins to Unpause the server. """374 """ Permit Admins to Unpause the server. """
375 ctxt = req.environ['nova.context']375 ctxt = req.environ['nova.context']
376 try:376 try:
@@ -382,7 +382,7 @@
382 return webob.Response(status_int=202)382 return webob.Response(status_int=202)
383383
384 @scheduler_api.redirect_handler384 @scheduler_api.redirect_handler
385 def suspend(self, req, id, body):385 def suspend(self, req, id):
386 """permit admins to suspend the server"""386 """permit admins to suspend the server"""
387 context = req.environ['nova.context']387 context = req.environ['nova.context']
388 try:388 try:
@@ -394,7 +394,7 @@
394 return webob.Response(status_int=202)394 return webob.Response(status_int=202)
395395
396 @scheduler_api.redirect_handler396 @scheduler_api.redirect_handler
397 def resume(self, req, id, body):397 def resume(self, req, id):
398 """permit admins to resume the server from suspend"""398 """permit admins to resume the server from suspend"""
399 context = req.environ['nova.context']399 context = req.environ['nova.context']
400 try:400 try:
401401
=== modified file 'nova/tests/api/openstack/test_servers.py'
--- nova/tests/api/openstack/test_servers.py 2011-08-02 23:31:14 +0000
+++ nova/tests/api/openstack/test_servers.py 2011-08-03 17:37:44 +0000
@@ -1756,74 +1756,50 @@
17561756
1757 def test_server_pause(self):1757 def test_server_pause(self):
1758 self.flags(allow_admin_api=True)1758 self.flags(allow_admin_api=True)
1759 body = dict(server=dict(
1760 name='server_test', imageId=2, flavorId=2, metadata={},
1761 personality={}))
1762 req = webob.Request.blank('/v1.0/servers/1/pause')1759 req = webob.Request.blank('/v1.0/servers/1/pause')
1763 req.method = 'POST'1760 req.method = 'POST'
1764 req.content_type = 'application/json'1761 req.content_type = 'application/json'
1765 req.body = json.dumps(body)
1766 res = req.get_response(fakes.wsgi_app())1762 res = req.get_response(fakes.wsgi_app())
1767 self.assertEqual(res.status_int, 202)1763 self.assertEqual(res.status_int, 202)
17681764
1769 def test_server_unpause(self):1765 def test_server_unpause(self):
1770 self.flags(allow_admin_api=True)1766 self.flags(allow_admin_api=True)
1771 body = dict(server=dict(
1772 name='server_test', imageId=2, flavorId=2, metadata={},
1773 personality={}))
1774 req = webob.Request.blank('/v1.0/servers/1/unpause')1767 req = webob.Request.blank('/v1.0/servers/1/unpause')
1775 req.method = 'POST'1768 req.method = 'POST'
1776 req.content_type = 'application/json'1769 req.content_type = 'application/json'
1777 req.body = json.dumps(body)
1778 res = req.get_response(fakes.wsgi_app())1770 res = req.get_response(fakes.wsgi_app())
1779 self.assertEqual(res.status_int, 202)1771 self.assertEqual(res.status_int, 202)
17801772
1781 def test_server_suspend(self):1773 def test_server_suspend(self):
1782 self.flags(allow_admin_api=True)1774 self.flags(allow_admin_api=True)
1783 body = dict(server=dict(
1784 name='server_test', imageId=2, flavorId=2, metadata={},
1785 personality={}))
1786 req = webob.Request.blank('/v1.0/servers/1/suspend')1775 req = webob.Request.blank('/v1.0/servers/1/suspend')
1787 req.method = 'POST'1776 req.method = 'POST'
1788 req.content_type = 'application/json'1777 req.content_type = 'application/json'
1789 req.body = json.dumps(body)
1790 res = req.get_response(fakes.wsgi_app())1778 res = req.get_response(fakes.wsgi_app())
1791 self.assertEqual(res.status_int, 202)1779 self.assertEqual(res.status_int, 202)
17921780
1793 def test_server_resume(self):1781 def test_server_resume(self):
1794 self.flags(allow_admin_api=True)1782 self.flags(allow_admin_api=True)
1795 body = dict(server=dict(
1796 name='server_test', imageId=2, flavorId=2, metadata={},
1797 personality={}))
1798 req = webob.Request.blank('/v1.0/servers/1/resume')1783 req = webob.Request.blank('/v1.0/servers/1/resume')
1799 req.method = 'POST'1784 req.method = 'POST'
1800 req.content_type = 'application/json'1785 req.content_type = 'application/json'
1801 req.body = json.dumps(body)
1802 res = req.get_response(fakes.wsgi_app())1786 res = req.get_response(fakes.wsgi_app())
1803 self.assertEqual(res.status_int, 202)1787 self.assertEqual(res.status_int, 202)
18041788
1805 def test_server_reset_network(self):1789 def test_server_reset_network(self):
1806 self.flags(allow_admin_api=True)1790 self.flags(allow_admin_api=True)
1807 body = dict(server=dict(
1808 name='server_test', imageId=2, flavorId=2, metadata={},
1809 personality={}))
1810 req = webob.Request.blank('/v1.0/servers/1/reset_network')1791 req = webob.Request.blank('/v1.0/servers/1/reset_network')
1811 req.method = 'POST'1792 req.method = 'POST'
1812 req.content_type = 'application/json'1793 req.content_type = 'application/json'
1813 req.body = json.dumps(body)
1814 res = req.get_response(fakes.wsgi_app())1794 res = req.get_response(fakes.wsgi_app())
1815 self.assertEqual(res.status_int, 202)1795 self.assertEqual(res.status_int, 202)
18161796
1817 def test_server_inject_network_info(self):1797 def test_server_inject_network_info(self):
1818 self.flags(allow_admin_api=True)1798 self.flags(allow_admin_api=True)
1819 body = dict(server=dict(
1820 name='server_test', imageId=2, flavorId=2, metadata={},
1821 personality={}))
1822 req = webob.Request.blank(1799 req = webob.Request.blank(
1823 '/v1.0/servers/1/inject_network_info')1800 '/v1.0/servers/1/inject_network_info')
1824 req.method = 'POST'1801 req.method = 'POST'
1825 req.content_type = 'application/json'1802 req.content_type = 'application/json'
1826 req.body = json.dumps(body)
1827 res = req.get_response(fakes.wsgi_app())1803 res = req.get_response(fakes.wsgi_app())
1828 self.assertEqual(res.status_int, 202)1804 self.assertEqual(res.status_int, 202)
18291805