summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJosh Kearney <josh@jk0.org>2011-06-24 11:55:43 -0500
committerJosh Kearney <josh@jk0.org>2011-06-24 11:55:43 -0500
commitcbf9f1bef113d54be57e2bb9a79990226afcd90f (patch)
treefbdec79d7174106fa920122bb737e66c7d010a21 /nova/api
parent4a32c971893a22a6451eed7e618291ad86c24510 (diff)
Adding tests for backup no rotation, invalid image type
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/images.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/nova/api/openstack/images.py b/nova/api/openstack/images.py
index d8dbd2360..2287ca0f7 100644
--- a/nova/api/openstack/images.py
+++ b/nova/api/openstack/images.py
@@ -122,13 +122,17 @@ class Controller(object):
image_name = get_param("name")
image = self._compute_service.snapshot(context, server_id,
image_name)
- else:
+ elif image_type in ("daily", "weekly"):
if not FLAGS.allow_admin_api:
raise webob.exc.HTTPBadRequest()
rotation = int(get_param("rotation"))
image = self._compute_service.backup(context, server_id,
image_type, rotation)
+ else:
+ LOG.error(_("Invalid image_type '%s' passed" % image_type))
+ raise webob.exc.HTTPBadRequest()
+
return dict(image=self.get_builder(req).build(image, detail=True))