summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorAlex Meade <alex.meade@rackspace.com>2011-08-04 16:38:55 -0400
committerAlex Meade <alex.meade@rackspace.com>2011-08-04 16:38:55 -0400
commit5b463f5d14c62f66250d5edc3edbd2ded704e0da (patch)
treee91bd83351f9e9607f9b7199c1b2322fa1d96b1b /nova/api
parent0f515d6d31b2c95ed7f1e3ca8d9d67f98fda9fbe (diff)
Added missing tests for server actions
Updated reboot to verify the reboot type is HARD or SOFT Fixed case of having an empty flavorref on resize
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/servers.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py
index 3acc4510e..fa4d11e24 100644
--- a/nova/api/openstack/servers.py
+++ b/nova/api/openstack/servers.py
@@ -268,9 +268,13 @@ class Controller(object):
def _action_reboot(self, input_dict, req, id):
if 'reboot' in input_dict and 'type' in input_dict['reboot']:
reboot_type = input_dict['reboot']['type']
+ if (not reboot_type == 'HARD') and (not reboot_type == 'SOFT'):
+ msg = _("Argument 'type' for reboot is not HARD or SOFT")
+ LOG.exception(msg)
+ raise exc.HTTPBadRequest()
else:
LOG.exception(_("Missing argument 'type' for reboot"))
- raise exc.HTTPUnprocessableEntity()
+ raise exc.HTTPBadRequest()
try:
# TODO(gundlach): pass reboot_type, support soft reboot in
# virt driver
@@ -646,6 +650,9 @@ class ControllerV11(Controller):
""" Resizes a given instance to the flavor size requested """
try:
flavor_ref = input_dict["resize"]["flavorRef"]
+ if not flavor_ref:
+ msg = _("Resize request has invalid 'flavorRef' attribute.")
+ raise exc.HTTPBadRequest(explanation=msg)
except (KeyError, TypeError):
msg = _("Resize requests require 'flavorRef' attribute.")
raise exc.HTTPBadRequest(explanation=msg)