diff options
| author | William Wolf <throughnothing@gmail.com> | 2011-06-01 23:13:01 -0400 |
|---|---|---|
| committer | William Wolf <throughnothing@gmail.com> | 2011-06-01 23:13:01 -0400 |
| commit | 707af42c90d3840c7bd965be53c2a787887c3c46 (patch) | |
| tree | 7f0ffd7c5970b3c14879ff8c2f734d44a06f2988 /nova/api | |
| parent | 5ded1f2c1d0d14b3c04df137f7cc6a0b65e53fda (diff) | |
| parent | 78093e8101d1981fc1fbafc963023bc70ad6b3b6 (diff) | |
merge from trunk
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/servers.py | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index f2ce64e78..0f7dde389 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -299,19 +299,7 @@ class Controller(object): return exc.HTTPAccepted() def _action_resize(self, input_dict, req, id): - """ Resizes a given instance to the flavor size requested """ - try: - if 'resize' in input_dict and 'flavorId' in input_dict['resize']: - flavor_id = input_dict['resize']['flavorId'] - self.compute_api.resize(req.environ['nova.context'], id, - flavor_id) - else: - LOG.exception(_("Missing arguments for resize")) - return faults.Fault(exc.HTTPUnprocessableEntity()) - except Exception, e: - LOG.exception(_("Error in resize %s"), e) - return faults.Fault(exc.HTTPBadRequest()) - return exc.HTTPAccepted() + return exc.HTTPNotImplemented() def _action_reboot(self, input_dict, req, id): if 'reboot' in input_dict and 'type' in input_dict['reboot']: @@ -577,6 +565,21 @@ class ControllerV10(Controller): self.compute_api.set_admin_password(context, server_id, inst_dict['server']['adminPass']) + def _action_resize(self, input_dict, req, id): + """ Resizes a given instance to the flavor size requested """ + try: + if 'resize' in input_dict and 'flavorId' in input_dict['resize']: + flavor_id = input_dict['resize']['flavorId'] + self.compute_api.resize(req.environ['nova.context'], id, + flavor_id) + else: + LOG.exception(_("Missing 'flavorId' argument for resize")) + return faults.Fault(exc.HTTPUnprocessableEntity()) + except Exception, e: + LOG.exception(_("Error in resize %s"), e) + return faults.Fault(exc.HTTPBadRequest()) + return exc.HTTPAccepted() + def _action_rebuild(self, info, request, instance_id): context = request.environ['nova.context'] instance_id = int(instance_id) @@ -662,6 +665,22 @@ class ControllerV11(Controller): LOG.info(msg) raise faults.Fault(exc.HTTPBadRequest(explanation=msg)) + def _action_resize(self, input_dict, req, id): + """ Resizes a given instance to the flavor size requested """ + try: + if 'resize' in input_dict and 'flavorRef' in input_dict['resize']: + flavor_ref = input_dict['resize']['flavorRef'] + flavor_id = common.get_id_from_href(flavor_ref) + self.compute_api.resize(req.environ['nova.context'], id, + flavor_id) + else: + LOG.exception(_("Missing 'flavorRef' argument for resize")) + return faults.Fault(exc.HTTPUnprocessableEntity()) + except Exception, e: + LOG.exception(_("Error in resize %s"), e) + return faults.Fault(exc.HTTPBadRequest()) + return exc.HTTPAccepted() + def _action_rebuild(self, info, request, instance_id): context = request.environ['nova.context'] instance_id = int(instance_id) |
