Bug 1042348

Summary: [RFE][ceilometer]: Allow optional sending/receiving request headers from reporting api to storage layer
Product: Red Hat OpenStack Reporter: RHOS Integration <rhos-integ>
Component: RFEsAssignee: RHOS Maint <rhos-maint>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: markmc, yeylon
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://blueprints.launchpad.net/ceilometer/+spec/optional-send-api-request-headers-to-storage-layer
Whiteboard: upstream_milestone_none upstream_status_unknown upstream_definition_obsolete
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-19 17:39:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description RHOS Integration 2013-12-12 21:49:54 UTC
Cloned from launchpad blueprint https://blueprints.launchpad.net/ceilometer/+spec/optional-send-api-request-headers-to-storage-layer.

Description:

In the case of role based authorization control it can be useful to have the http request information in the storage layer.  For example, if fine-grained tenant grouping information is stored in the database, being able to retrieve  metadata based on the user's role(s) would be necessary.

Propose that methods like MeterController.get_all check the storage layer's signature (already obtained from _query_to_kwargs) for presence of an optional parameter (like "request_headers"), and if it's present pass the request headers.  It might look like this:

        if 'request_headers' in kwargs:
            return [Sample.from_db_model(e)
                    for e in pecan.request.storage_conn.get_samples(
                        f, request_headers=pecan.request.headers, limit=limit)]
        else:
            return [Sample.from_db_model(e)
                    for e in pecan.request.storage_conn.get_samples(
                        f, limit=limit)]

Since this is optional for every storage class, it would require no changes to any storage implementation classes.  It would enable the flexibility to write storage drivers which use the request header information, or to extend existing drivers to do so.

Specification URL (additional information):

None