Introduce a new ObjectStorageMax transformer which
takes a container and bases the service for it on the
policy used for it in swift so that we can charge differently
for each policy.
Change-Id: Id1a0d7783ae72de0a2da36245badbd770508be81
To keep consistent with other projects and enable 'admin_or_owner' rule
in policy.json, this patch adds neccessary fields for policy check
target and use correct method to get context dictionary.
To be clear, the rule in policy.json 'project_id:%(project_id)s' comes
from Nova originally, the policy module will get project_id from
request URL to Nova service andn compare with project_id in the user
credential. For other projects which don't contain project_id in URL,
just get it from user credential to make the rule work properly.
Change-Id: I5979f2c5204e373cc4a84b1f6997845aabc891cb
Currently, only admin user can consume the billing REST
API which means tenant user can't monitor/audit their usage/cost
via API. This patch opens the API by making the project id as
optional for admin user and getting the project id from context
for non-admin user.
Change-Id: I497348dfae882892826ec8bcd2303195e4fe2b31
Support /credits API so that project users can track their current
credit by API. And the credits info can be also shown on the
distil panel.
Change-Id: I5b44d8b05b551c5db3416c00b7caf472c3350be8
Query database directly using filtering mechanism to make logic
in API layer clear and simple.
Make the API only accessible to admin only for the time being.
Currently, we only check usage collection to achieve feature parity
with current monitoring requirements. In future, we could add running
status for ERP system, etc.
Change-Id: I044cd10780f2305775d05b107be5e87c41ce7826
Distil will update instance metadata using the last sample metadata
from Ceilometer in each collect window loop. Sometimes, the last sample
is not valid, which will lead to wrong property(e.g. 'host') in
database.
This change will wash the data points during trasformation to make
sure it contains valid information in the data points.
Also, make Distil get instance host name from 'node' propery first then
'host', because in notification samples Ceilometer will override the value
using publisher id. 'node' field doesn't exist for samples generated by
Nova API query.
This change only touch the Distil V2 code. Fix for Distil V1 will be
covered in a seperate patch.
Change-Id: I7346f928f8f7356a47403429e09f0b1495aa82c4
Allow user get current month estimated cost. The output data
structure is the same with /invoices api.
Also remove the unused /costs api and rater module.
Change-Id: I582afa6cf7e5b86cc54db58ead501793e727bfd6
The plural format of usage is not proper in the context of billing.
measures could be a better name, especially given that the data in
Distil has been transformed, reflecting a time-based measurement.
Change-Id: Iece7bdb44fc6b80623477c55064998c6b0d75140
Currently the mapping to collect host info of instance is not correct,
and unfortunately, we can only get a hexdigest of project_id + host_name.
But we can get the correct host name by using the same algorithm when
doing billing.
Closes-Bug: #1665191
Change-Id: I0585c1e9a01250e6b34f3c1d060b76db34fcd6bf
- Use InstanceUptime transformer instead of Uptime(Uptime is not used
anywhere).
- Get instance flavor name direct from instance metadata to avoiding
calling nova api.
- Fix empty sequence error in NetworkServiceTransformer.
- Add unit tests for new transformer code.
Change-Id: I22e1f854ac26dba3824a7e1df0850522aa2ea774
Using oslo.policy to support access control for Distil API
access, which will follow the community way.
Change-Id: I670d9fde4f5c368e82c26b512b7c1e46c2e380ec
TODO:
- implement get_meter function in CeilometerCollector
- implement _get_projects function in CollectorService
- implement usages_add function in db layer
- split tenants handling in different thread
- more rigorous testing
Change-Id: I0235c78c7dc520e4bf08405ebf8e06875868daab