diff options
| author | Davanum Srinivas <dims@linux.vnet.ibm.com> | 2013-02-07 22:42:19 -0500 |
|---|---|---|
| committer | Davanum Srinivas <dims@linux.vnet.ibm.com> | 2013-02-15 10:17:56 -0500 |
| commit | 23f7ee89ed5b5310b1604c3f745ae62b6969a0f0 (patch) | |
| tree | 1d272ba8c1fc6f66f45b6db4d8ce3c9cf7941991 /nova/api | |
| parent | fa0498bd246b5e97b8a9b18f33a8d16ce08e2f8a (diff) | |
Ensure start time is earlier than end time in simple_tenant_usage
Simple check and respond with a http 400 if the start time is later
Fixes LP# 1118910
Change-Id: I95f12abca725f347488e620d8c699f424e53ed23
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/simple_tenant_usage.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/nova/api/openstack/compute/contrib/simple_tenant_usage.py b/nova/api/openstack/compute/contrib/simple_tenant_usage.py index 2313c00ac..f219689f7 100644 --- a/nova/api/openstack/compute/contrib/simple_tenant_usage.py +++ b/nova/api/openstack/compute/contrib/simple_tenant_usage.py @@ -18,6 +18,8 @@ import datetime import urlparse +from webob import exc + from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova.api.openstack import xmlutil @@ -204,6 +206,11 @@ class SimpleTenantUsageController(object): period_start = self._parse_datetime(env.get('start', [None])[0]) period_stop = self._parse_datetime(env.get('end', [None])[0]) + if not period_start < period_stop: + msg = _("Invalid start time. The start time cannot occur after " + "the end time.") + raise exc.HTTPBadRequest(explanation=msg) + detailed = env.get('detailed', ['0'])[0] == '1' return (period_start, period_stop, detailed) |
