Settings / OpenStack Plans¶
An OpenStack plan is a collection or prices (rules with prices) for individual resources such as Instances, Volumes, Images or Network bandwidth
To create a new plan click the button from the bottom right corner of the screen.
The following modal window will pop up, and you’ll be able to choose:
Name
: The name associated with the planCurrency
: The currency that the pricing plan will useDefault billing plan
: When a new default billing plan is set it will apply for newly created clients. It does not change for existing clients.
You must always have at least one pricing plan defined but fleio allows you to create additional ones.
The default
plan applies to all customers by default, and you can define additional pricing plans for various
customer categories. For instance, you can to define discounts and use a different currency for a subset of
customers.
The currency is selected per plan and applies for all pricing rules in that plan.
Note that a client is always invoiced using his default currency. The exchange rate will be applied to the amount determined by the pricing rules (if the client’s currency is different from the plan’s currency).
Right now you can create pricing rules for instances, volumes, images and L3 bandwidth, assuming L3 networking is used.
Future Fleio releases will support any kind of OpenStack resources, like VPN or Swift objects.
Deleting a plan¶
Click the Delete plan
icon when hovering over a plan or enter its details page and hover over the action button. If
you delete a plan, you’ll need to select another one to migrate the clients in the openstack plan you select.
Pricing Rules¶
To create a new pricing rule, click the (+) button either from the openstack plan details page or the openstack plans page when hovering an item. You’ll get redirected a new page with the following form that will be explained below.
One plan includes several pricing rules, each with its own set of filters and modifiers. The currency set for the billing plan is used for all pricing rules in that plan.
OpenStack resource type and data collection method¶
Each pricing rule must be defined on a type of resource (e.g. instance, volume, floating ip, etc.). The data collection method for each resource type might be different, and you can find it in the following table:
Resource type |
Data collection method |
---|---|
Instance |
OpenStack notifications |
Image |
OpenStack notifications |
Volume |
OpenStack notifications |
Network (data traffic per project) |
Gnocchi |
Object storage |
Gnocchi |
Instance traffic |
Gnocchi |
Ceph object storage |
Gnocchi |
Volume snapshot |
OpenStack notifications |
Volume backups |
OpenStack notifications |
Floating IPs |
OpenStack notifications |
DNS Domains |
OpenStack notifications |
Instance IPs |
OpenStack notifications |
Common Pricing Rules Features¶
- Pricing rules are not exclusive:
multiple rules can apply to the same cloud resource and the price outcome of each rule will be added to the total price.
The pricing rule name is only used for staff reference.
- The Pricing attribute is used to determine what to charge for.
For example, in case of an Image, a Pricing Attribute set to size will calculate the price based on the Image size. If the Pricing Attribute would be set to existence, then the price of an image of any size would be set.
- The Unit can be set for specific attributes like memory_mb or any attribute that can be converted to a different size.
If you want to charge an instance per GB of memory, you would set the Pricing attribute to memory_mb and the Unit to Gigabytes. Example: Charge $1 per 2GB of Instance RAM/Hour translates to Pricing attribute set to memory_mb, Unit set to Gigabytes, Time unit set to Hour and price set to 1, assuming the Plan currency is USD.
- The Time unit sets the unit of time the price is for. As an example, a time unit
of hour and the Pricing attribute set to existence means the price is set for every hour the instance exists in the cloud.
- The total cost for a resource may end up being negative, especially when negative modifiers are used for discounts.
Fleio deals with these prices by setting them to zero. This can be controlled from the Fleio settings.py file by setting OSBILLING_NEGATIVE_PRICE_ALWAYS_ZERO to False if you want negative prices (increasing your client’s credit balance in time) or True, which is the default, to always set negative prices to zero.
Filters¶
Pricing rules are by default applied to all resources of a type. To limit the scope of a pricing rule to a subset of resources, filters should be applied. Typical filters are: instance_type is m1.small or volume_type is SSD. For example, setting the filter instance_type is m1.small on an Instance pricing rule, will configure the pricing rule to only apply on instances with the m1.small flavor set.
Multiple filters can be added. The logical AND is used between them. In other words: the pricing rule applies only if all the filters are true.
Price Modifiers¶
Price modifiers define additional cost added or subtracted to/from the rule’s base price. For example, if you want to offer a discount of 10% for instances in a specific availability_zone you would create a modifier with the Attribute name set to availability_zone and the name of the availability zone desired, check the Price is percent checkbox and set the percent to -10 (as negative for discount). If you instead would like to charge a fixed amount of $10 for each instance running Windows, you would create a modifier with the os_type attribute set to windows and a fixed price of 10USD and the Time unit set to hour.
Price modifiers can match a list of values when the resource attribute is a normal text. For example, if you wish to match multiple OpenStack Compute cells, you would select the cell_name as the Attribute the In list or Not in list operator and for the value, each name should be separated by “,” as below:
cell1,
cell2,
cell3
Instance Pricing Rule¶
Price can be applied on compute instances based on one of the following:
existence: A price per Time Unit (second, minute, hour, billing cycle).
vcpu: The price per Time Unit is multiplied with the number of virtual CPU cores.
root_gb: The price per Time Unit is multiplied with the number of GB of the instance’s main disk.
memory_mb: The price per Time Unit is multiplied with the number of MB of the instance’s memory.
ephemeral_gb: The price per Time Unit is multiplied with the number of GB of the instance’s ephemeral disk size.
An OpenStack instance passes through several states in its lifetime.
You can define the list of states when you want the instance to be charged or list of states that you do not want to charge.
E.g. if you do not want to charge instances that are in building
or error
state, you can add a filter on the
pricing rule and choose in the Add filter dialog Attribute name: state
, Operator: Not in list
and
Value: building,error,stopped
. Note that states are case-sensitive and must be all lower case.
Possible instance states that you can define filters on:
building
active
paused
rescued
suspended
resized
error
WARNING: If you add a pricing rule filter for a state, like active
, or for a list of states all other instance
states will not incur cost for the end-user.
Image Pricing Rule¶
OpenStack Glance image storage can be priced on:
existence: A price per Time Unit (second, minute, hour, billing cycle) regardless of the size in GB.
size: The price per Time Unit is multiplied with the size of the image. You can select the Size Unit: Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Petabytes.
Volume Pricing Rule¶
OpenStack Cinder volumes (also known as block devices) are priced on the same characteristics as images:
existence: A price per Time Unit (second, minute, hour, billing cycle) regardless of the size in GB.
size: The price per Time Unit is multiplied with the size of the image. You can select the Size Unit: Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Petabytes.
Network Pricing Rule¶
This rule applies to the number of GB that have passed through an L3 network.
Flat pricing means that the number of GB is multiplied with the Price per GB that is filled in.
Tiered pricing allows to set difference pricing depending on the volume of GB that is charged. For example, you can define that the first 1 000 GB cost 0.05 EUR per GB, the following GB up to 10 000 GB cost 0.045 EUR per GB, and the next GB (from 10 000 GB to infinite) cost 0.04 EUR.
You can also set the first tier to be free. I.e. the first 2500 GB are included at no cost. For example:
0 - 2500GB will be free 2500 GB - 5000 GB, 0.003 / GB 5000 GB - infinite, 0.006 / GB
If the client has 7000 GB of traffic he will be billed as following:
5000 GB (for the 2500 GB - 5000 GB tier) at 0.003 / GB (7.5 EUR)
2000 GB (for the 5000 GB - infinite tier) at 0.006 / GB (12 EUR)
Total billed for this instance will be 19.5 EUR (2500 GB at 0.003 / GB (7.5 EUR) + 2000 GB at 0.006 / GB (12 EUR)) .
NOTE How to configure OpenStack to support network bandwidth billing/accounting.
The neutron-metering-agent needs to be installed besides each neutron-l3-agent in order to support L3 networking accounting.
Follow the simple configuration for the metering agent: configure-metering-agent
Assuming we would like to account for the external traffic, we may want to create the following label with rules:
First create a shared label that will automatically be applied to all projects:
openstack network meter create --description Shared --share bandwidth
Create a rule for the bandwidth label to account for the packets leaving the project router
openstack network meter rule create --egress --remote-ip-prefix 0.0.0.0/0 bandwidth
Create another rule to account for the packets entering the project router
openstack network meter rule create --ingress --remote-ip-prefix 0.0.0.0/0 bandwidth
If we wish to exclude any destination we can add another rule together with the –exclude switch:
openstack network meter rule create --exclude --ingress --remote-ip-prefix 0.0.0.0/0 bandwidth
The above rule excludes all traffic going to 10.0.0.0/8
Assuming we have the Neutron L3 metering agent installed and the Ceilometer notification agent and Gnocchi and a Fleio pricing rule defined for bandwidth, the traffic accounting should start to display the cost for L3 networking in a few minutes.
Object storage Pricing Rules¶
This assumes that Ceilometer was set up to gather metrics correctly and send them to Gnocchi for further processing.
Fleio has support for Swift billing on the following metrics:
storage.objects.incoming.bytes - the total incoming network traffic in Gigabytes during a month
storage.objects.outgoing.bytes - the total outgoing network traffic in Gigabytes during a month
storage.objects - the average number of objects in a month is computed and the price is per object-month.
storage.objects.containers - the average number of object containers in a month is computed and the price is per container-month.
storage.objects.size - the average size in Gigabytes of all objects is computed during a month and the price is set per GB-month.
Flei also collect the following metrics for CEPH object storage:
radosgw.api.requests - number of API requests against Ceph Object Gateway (radosgw)
radosgw.objects - number of objects
radosgw.objects.containers - number of containers
radosgw.objects.size - total size of stored objects
Notice the names of a few metrics: storage.objects.incoming.bytes, ..outgoing.bytes. Fleio will always rescale this values to Gigabytes.
As an example, say you would like to charge a customer for the total size used on Swift during one month with 31 days. Let’s assume the customer uses 10 GB of storage on the first 5 days of the month, 15 GB on the next 20 days and 20 GB on the last 6 days. Let’s also assume the price is set to $1/GB-month of storage. That would result in the following price calculation:
Price = (10 GB * 5 days + 15 GB * 20 days + 20 GB * 6 days) / 31 days * $1 = $15.16 for that month
Instance traffic Pricing Rules¶
This assumes traffic data collecting was set up correctly in Fleio. See traffic monitoring for more details.
Fleio has support for billing the following types of instance traffic.
Incoming public traffic - the incoming public traffic for an instance
Incoming private traffic - the incoming private traffic for an instance
Outgoing public traffic - the outgoing public traffic for an instance
Outgoing private traffic - the outgoing private traffic for an instance
Total public traffic - total public traffic for an instance
Total private traffic - total private traffic for an instance
Total traffic - total traffic per instance
Pricing is specified in GB/billing cycle.
Distinction between public and private traffic is done based on ip address at port level. If a port as at least one public ip address all traffic on that port is considered public traffic. If a port has only private ip addresses then all traffic on that port is considered private.