summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJohannes Erdfelt <johannes.erdfelt@rackspace.com>2011-08-11 18:28:15 +0000
committerJohannes Erdfelt <johannes.erdfelt@rackspace.com>2011-08-11 18:28:15 +0000
commit3bfaf0a0720fc8713fb77fddd8f1b2dffa0eabfc (patch)
tree3c5dc69fc5d37b05a304cc23c5a31d0f9fad15ab /nova/api
parent24869338aad2dfd36db9d466820325d1a3ed1adb (diff)
downloadnova-3bfaf0a0720fc8713fb77fddd8f1b2dffa0eabfc.tar.gz
nova-3bfaf0a0720fc8713fb77fddd8f1b2dffa0eabfc.tar.xz
nova-3bfaf0a0720fc8713fb77fddd8f1b2dffa0eabfc.zip
v1.0 and v1.1 API differs for PUT, so split them out
Update tests to match API
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/servers.py72
1 files changed, 46 insertions, 26 deletions
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py
index 0f8e8e461..90b6e684b 100644
--- a/nova/api/openstack/servers.py
+++ b/nova/api/openstack/servers.py
@@ -161,32 +161,6 @@ class Controller(object):
server['server']['adminPass'] = extra_values['password']
return server
- @scheduler_api.redirect_handler
- def update(self, req, id, body):
- """ Updates the server name or password """
- if len(req.body) == 0:
- raise exc.HTTPUnprocessableEntity()
-
- if not body:
- raise exc.HTTPUnprocessableEntity()
-
- ctxt = req.environ['nova.context']
- update_dict = {}
-
- if 'name' in body['server']:
- name = body['server']['name']
- self.helper._validate_server_name(name)
- update_dict['display_name'] = name.strip()
-
- self._parse_update(ctxt, id, body, update_dict)
-
- try:
- self.compute_api.update(ctxt, id, **update_dict)
- except exception.NotFound:
- raise exc.HTTPNotFound()
-
- return webob.Response() # 200 response
-
def _parse_update(self, context, id, inst_dict, update_dict):
pass
@@ -546,6 +520,29 @@ class ControllerV10(Controller):
"""v1.0 OpenStack API controller"""
@scheduler_api.redirect_handler
+ def update(self, req, id, body):
+ """ Updates the server name or password """
+ if len(req.body) == 0 or not body:
+ raise exc.HTTPUnprocessableEntity()
+
+ ctxt = req.environ['nova.context']
+ update_dict = {}
+
+ if 'name' in body['server']:
+ name = body['server']['name']
+ self.helper._validate_server_name(name)
+ update_dict['display_name'] = name.strip()
+
+ self._parse_update(ctxt, id, body, update_dict)
+
+ try:
+ self.compute_api.update(ctxt, id, **update_dict)
+ except exception.NotFound:
+ raise exc.HTTPNotFound()
+
+ return exc.HTTPNoContent()
+
+ @scheduler_api.redirect_handler
def delete(self, req, id):
""" Destroys a server """
try:
@@ -615,6 +612,29 @@ class ControllerV11(Controller):
"""v1.1 OpenStack API controller"""
@scheduler_api.redirect_handler
+ def update(self, req, id, body):
+ """ Updates the server name or password """
+ if len(req.body) == 0 or not body:
+ raise exc.HTTPUnprocessableEntity()
+
+ ctxt = req.environ['nova.context']
+ update_dict = {}
+
+ if 'name' in body['server']:
+ name = body['server']['name']
+ self.helper._validate_server_name(name)
+ update_dict['display_name'] = name.strip()
+
+ self._parse_update(ctxt, id, body, update_dict)
+
+ try:
+ self.compute_api.update(ctxt, id, **update_dict)
+ except exception.NotFound:
+ raise exc.HTTPNotFound()
+
+ # v1.1 API returns 200, which differs from v1.0
+
+ @scheduler_api.redirect_handler
def delete(self, req, id):
""" Destroys a server """
try: