summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-09-05 22:09:22 +0000
committerGerrit Code Review <review@openstack.org>2012-09-05 22:09:22 +0000
commit06dec8ec1e518c33d00df2e88ffea92cf236a8dc (patch)
treee83662afe0eb428e2ebec3c965de42a55fd61c11 /nova/api
parent1ca3d8d15e560076d8e620fd7f61529f0fb2d000 (diff)
parent869443f41c8826c9a4de1dcc65c5a5354b623a04 (diff)
Merge "Fix simple_tenant_usage's handing of future end times"
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/simple_tenant_usage.py6
1 files changed, 6 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 75a3ddfc1..ee7924dec 100644
--- a/nova/api/openstack/compute/contrib/simple_tenant_usage.py
+++ b/nova/api/openstack/compute/contrib/simple_tenant_usage.py
@@ -218,6 +218,9 @@ class SimpleTenantUsageController(object):
authorize_list(context)
(period_start, period_stop, detailed) = self._get_datetime_range(req)
+ now = timeutils.utcnow()
+ if period_stop > now:
+ period_stop = now
usages = self._tenant_usages_for_period(context,
period_start,
period_stop,
@@ -233,6 +236,9 @@ class SimpleTenantUsageController(object):
authorize_show(context, {'project_id': tenant_id})
(period_start, period_stop, ignore) = self._get_datetime_range(req)
+ now = timeutils.utcnow()
+ if period_stop > now:
+ period_stop = now
usage = self._tenant_usages_for_period(context,
period_start,
period_stop,