~ubuntu-cloud-archive/ubuntu/precise/nova/trunk

« back to all changes in this revision

Viewing changes to nova/api/openstack/compute/contrib/simple_tenant_usage.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Soren Hansen
  • Date: 2012-09-07 17:49:53 UTC
  • mfrom: (1.1.61)
  • Revision ID: package-import@ubuntu.com-20120907174953-oapuvix1jxm830he
Tags: 2012.2~rc1~20120907.15996-0ubuntu1
[ Chuck Short ]
* New upstream release.
* debian/nova-common.postinst: Drop nova_sudoers permission changing
  since we do it in the debian/rules. (LP: #995285)

[ Soren Hansen ]
* Update debian/watch to account for symbolically named tarballs and
  use newer URL.
* Fix Launchpad URLs in debian/watch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
212
212
 
213
213
    @wsgi.serializers(xml=SimpleTenantUsagesTemplate)
214
214
    def index(self, req):
215
 
        """Retrive tenant_usage for all tenants"""
 
215
        """Retrieve tenant_usage for all tenants"""
216
216
        context = req.environ['nova.context']
217
217
 
218
218
        authorize_list(context)
219
219
 
220
220
        (period_start, period_stop, detailed) = self._get_datetime_range(req)
 
221
        now = timeutils.utcnow()
 
222
        if period_stop > now:
 
223
            period_stop = now
221
224
        usages = self._tenant_usages_for_period(context,
222
225
                                                period_start,
223
226
                                                period_stop,
226
229
 
227
230
    @wsgi.serializers(xml=SimpleTenantUsageTemplate)
228
231
    def show(self, req, id):
229
 
        """Retrive tenant_usage for a specified tenant"""
 
232
        """Retrieve tenant_usage for a specified tenant"""
230
233
        tenant_id = id
231
234
        context = req.environ['nova.context']
232
235
 
233
236
        authorize_show(context, {'project_id': tenant_id})
234
237
 
235
238
        (period_start, period_stop, ignore) = self._get_datetime_range(req)
 
239
        now = timeutils.utcnow()
 
240
        if period_stop > now:
 
241
            period_stop = now
236
242
        usage = self._tenant_usages_for_period(context,
237
243
                                               period_start,
238
244
                                               period_stop,