

def load_report_data(request):
    meters = ceilometer.Meters(request)
    services = {
        _('Nova'): meters.list_nova(),
        _('Neutron'): meters.list_neutron(),
        _('Glance'): meters.list_glance(),
        _('Cinder'): meters.list_cinder(),
        _('Swift_meters'): meters.list_swift(),
        _('Kwapi'): meters.list_kwapi(),
    }
    project_rows = {
        
    }
    date_options = request.GET.get('date_options', 7)
    date_from = request.GET.get('date_from')
    date_to = request.GET.get('date_to')
    try:
        (date_from, date_to) = utils_metering.calc_date_args(date_from, date_to, date_options)
    except Exception:
        exceptions.handle(request, _('Dates cannot be recognised.'))
    try:
        project_aggregates = utils_metering.ProjectAggregatesQuery(request, date_from, date_to, (3600 * 24))
    except Exception:
        exceptions.handle(request, _('Unable to retrieve project list.'))
    for meter in meters._cached_meters.values():
        service = None
        for (name, m_list) in services.items():
            if (meter in m_list):
                service = name
                break
        (res, unit) = project_aggregates.query(meter.name)
        for re in res:
            values = re.get_meter(meter.name.replace('.', '_'))
            if values:
                for value in values:
                    row = {
                        'name': 'none',
                        'project': re.id,
                        'meter': meter.name,
                        'description': meter.description,
                        'service': service,
                        'time': value._apiresource.period_end,
                        'value': value._apiresource.avg,
                    }
                    if (re.id not in project_rows):
                        project_rows[re.id] = [row]
                    else:
                        project_rows[re.id].append(row)
    return project_rows

dataset/ETHPy150Open CiscoSystems/avos/openstack_dashboard/dashboards/admin/metering/views.py load_report_data/original