Jump to: navigation, search

Ceilometer/blueprints/Add Billing in Ceilometer

< Ceilometer‎ | blueprints
Revision as of 09:31, 22 July 2014 by Pooja Tiwari (talk | contribs) (Added initial information for ceilometer billing blueprint)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Introduction

This blueprint aims for providing the admin user of a private cloud facility to view usage and billing details for the spawned instances. Admin can view project-wise billing details of each instance of that project. Usage of resources by the instances will be measured in terms of disk usage, network usage and CPU usage. Total cost for each project will be calculated. Admin user can create rate plans. Rate plans will define charges based on usage by the instance. Any rate plans can be applied for any instance to calculate its billing cost. For getting the billing deatils for each tenant/instance we will add more Ceilometer API. Ceilometer will measure usage of resources in terms of disk usage, network usage and CPU usage. For each instance the usage details for following meters will be shown:

1. Disk Read Bytes
2. Disk Write Bytes
3. Disk Write requests 
4. Disk Read requests 
5. Network Outgoing bytes 
6. Network Incoming bytes 
7. Network outgoing Packets 
8. Network incoming Packets 
9. CPU

For each instance ceilometer creates these cumulative meters.

User Stories

  1. Facility to view usage and billing details for the spawned instances.
  2. Project-wise details of each instance of that project.
  3. Usage of resources by the instances will be measured in terms of disk usage, network usage and CPU usage.
  4. Total cost for each project will be calculated as per the Rate plans defined.
  5. These use cases are accessible only for the Admin

Design

Database

In ceilometer we will add three tables inside ceilometer database, one for storing the rate plans, second is for storing the usage details for each instance along with its billing cost and other for storing the billing cost for each tenant.

Table for storing the billing cost for each tenant will be ‘tenant_bill’ and it will contain following fields:

  1. Tenant_id (primary key)
  2. From date
  3. To date
  4. Total Cost

Table for storing the usage details for each instance along with its billing cost will be ‘instance_bill’ and it will contain following fields:

  1. Instance_id (primary key)
  2. Tenant_id (foreign key)
  3. Rate_plan_id (id of rate plan that is being used by the instance)
  4. From date
  5. To date
  6. CPU usage
  7. Disk usage
  8. Network usage
  9. Total cost

Table for storing rate plans will be ‘rate_plans’ and it will contain following fields:

  1. Rate_plan_id (primary key)
  2. Name
  3. CPU cost per 8, 64,000 sec (in $)
  4. Disk cost per MB (in $)
  5. Network cost per MB (in $)

API

Query Type Resource
GET V2/billing
GET V2/billing/(instance_id)
GET V2/billing/(tenant_id)
POST V2/billing
POST V2/billing/(instance_id)
POST V2/billing/(tenant_id)
GET V2/billing/(rate_plan_id)
POST V2/billing/(rate_plan_id)

Implementation

UI Changes

For facilitating this, a ‘Billing’ panel group will be added in OpenStack Horizon Following three panels will be added in the Billing Panel group:

1. Add a Rate Plan

On selecting the “Add a Rate Plans” admin user will be shown a form which asks costs for each flavors and meters. Only Admin can create a new Rate Plan. Rate plans will be used for calculating bill for each project

2. View Rate Plans

On selecting the “View Rate Plans” admin user will be shown a list of available rate plans.

3. Usage and billing

On selecting the ‘Usage and Billing’ panel from the Billing panel group, the admin user will be shown a list of all projects their costs. On selecting the project the admin can view the details of the usage and bill calculation for that project.

Code Changes

Add code for making ceilometer API calls in horizon for getting the metering data per instance. Code to implement ceilometer api calls for billing.

Test/Demo Plan

This need not be added or completed until the specification is nearing beta.

BoF agenda and discussion

Use this section to take notes during the BoF, if you keep it in the approved spec, use it for summarizing what was discussed and note any options that were rejected.