summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorGabe Westmaas <gabe.westmaas@rackspace.com>2011-08-05 01:55:53 +0000
committerGabe Westmaas <gabe.westmaas@rackspace.com>2011-08-05 01:55:53 +0000
commit637dfc0f44cbd5bf0c76d80d708a241e562403ac (patch)
tree979a5dd36704a06de2c552b0e2f3bf846c7b3f6f /nova/api
parent02bf32d40cba09a688583e684f4b55dace1ee20a (diff)
Added explanations to exceptions and cleaned up reboot types
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/servers.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py
index fa4d11e24..9a55af8ea 100644
--- a/nova/api/openstack/servers.py
+++ b/nova/api/openstack/servers.py
@@ -267,14 +267,16 @@ 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'):
+ valid_reboot_types = ['HARD', 'SOFT']
+ reboot_type = input_dict['reboot']['type'].upper()
+ if not valid_reboot_types.count(reboot_type):
msg = _("Argument 'type' for reboot is not HARD or SOFT")
LOG.exception(msg)
- raise exc.HTTPBadRequest()
+ raise exc.HTTPBadRequest(explanation=msg)
else:
- LOG.exception(_("Missing argument 'type' for reboot"))
- raise exc.HTTPBadRequest()
+ msg = _("Missing argument 'type' for reboot")
+ LOG.exception(msg)
+ raise exc.HTTPBadRequest(explanation=msg)
try:
# TODO(gundlach): pass reboot_type, support soft reboot in
# virt driver