Jump to: navigation, search

Difference between revisions of "Ceilometer/blueprints/Add Billing in Ceilometer"

(Introduction)
 
Line 17: Line 17:
 
==User Stories==
 
==User Stories==
  
# Facility to view usage and billing details for the spawned instances.
+
# Facility to view billing details for the spawned instances.
 
# Project-wise details of each instance of that project.
 
# Project-wise 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.  
 
# 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 as per the Rate plans defined.  
+
# Total cost for each project will be calculated as per the Rate plans defined.  Rate Plan will define charges for CPU, network ,disk usage and flavor.
 +
# Whenever an instance boots up and come into ACTIVE state, its billing will be start from that moment. Default rate plan will be applied on it initially.
 +
# Facility to view/add/apply and delete rate plan.
 
# These use cases are accessible only for the Admin
 
# These use cases are accessible only for the Admin
  
Line 26: Line 28:
  
 
===Database===  
 
===Database===  
In ceilometer we will add two tables inside ceilometer database , one for storing the rate plans and other for stoting which rate plan is being applied to an instance.
+
In ceilometer we will add two tables inside ceilometer database , one for storing the rate plans and other for stoting billing details for each instance.
  
Table for storing rate plans will be ‘rate_plans’ and it will contain following fields:
+
1.Table for Rate plans will have following attributes:
# Rate_plan_id (primary key)
+
# Rateplaneid
 
# Name
 
# Name
# Cost for available flavors
+
# CPU cost per second
# Cost for disk usage
+
# Disk cost per MB
# Cost for network usage
+
# Network cost per MB
# Cost for CPU usage
+
# Cost for flavors
  
Table for mapping instances with rate plans:
+
2.Table for instance-bill will have following attributes:
#instance_id (primary key)
+
# resource_id
# rate_plane_id
+
# ratepaln_id
 +
# Date and time at which bill was calculated
 +
# resource_bill
  
 
===API===
 
===API===
Line 46: Line 50:
 
! Query Type !! Resource  
 
! Query Type !! Resource  
 
|-
 
|-
| GET || V2/billing
+
| GET || V2/bills
 
|-
 
|-
| GET || V2/billing/(instance_id)
+
| GET || V2/bills/(instance_id)
 
|-
 
|-
| GET || V2/billing/(tenant_id)
+
| GET || V2/rateplans
 
|-
 
|-
| POST || V2/billing
+
| GET || V2/rateplans/(rateplan_id)
 
|-
 
|-
| POST || V2/billing/(instance_id)
+
| POST || V2/rateplans
 
|-
 
|-
| POST || V2/billing/(tenant_id)
+
| DELETE || V2/rateplans/(rate_plan_id)
 
|-
 
|-
| GET || V2/billing/(rate_plan_id)
+
| PUT || V2/billing/(instance_id)/rateplans/(rate_plan_id)
|-
 
| POST || V2/billing/(rate_plan_id)
 
 
|}
 
|}
 
==Implementation==
 
==Implementation==
Line 75: Line 77:
  
 
===Code Changes===
 
===Code Changes===
 +
Will add billing-APIs in ceilometer.
 
Add code for making ceilometer API calls in horizon for getting the metering data per instance.
 
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==
 
==Test/Demo Plan==

Latest revision as of 08:41, 29 July 2014

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. There will be a default rate plan that will be applied to an instance if admin does not specify explicity which rate plan has to be used. 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 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. Rate Plan will define charges for CPU, network ,disk usage and flavor.
  5. Whenever an instance boots up and come into ACTIVE state, its billing will be start from that moment. Default rate plan will be applied on it initially.
  6. Facility to view/add/apply and delete rate plan.
  7. These use cases are accessible only for the Admin

Design

Database

In ceilometer we will add two tables inside ceilometer database , one for storing the rate plans and other for stoting billing details for each instance.

1.Table for Rate plans will have following attributes:

  1. Rateplaneid
  2. Name
  3. CPU cost per second
  4. Disk cost per MB
  5. Network cost per MB
  6. Cost for flavors

2.Table for instance-bill will have following attributes:

  1. resource_id
  2. ratepaln_id
  3. Date and time at which bill was calculated
  4. resource_bill

API

Query Type Resource
GET V2/bills
GET V2/bills/(instance_id)
GET V2/rateplans
GET V2/rateplans/(rateplan_id)
POST V2/rateplans
DELETE V2/rateplans/(rate_plan_id)
PUT V2/billing/(instance_id)/rateplans/(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

Will add billing-APIs in ceilometer. Add code for making ceilometer API calls in horizon for getting the metering data per instance.

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.