Setting up Virtual Datacenters

Tags: 340 views 0

How to set up Virtual Datacenters in the Atomia Platform.

Overview

With Virtual Datacenters your customers can fully utilise all OpenStack features by giving them their own tenant or project in OpenStack. The customer manages their services within their own isolated data center through the OpenStack dashboard Horizon.

There are two payment options:

  • Usage-based billing: The customer pays for the exactly what they use.
  • Subscription-based billing: The customer pays a fixed quota as per your definition.

The product needed for supplying Virtual Datacenters is a bit special compared to regular usage-based products. As opposed to regular usage based products, the Virtual Datacenter product creates a subscription in Atomia Billing to be able to separate the virtual data centers’ billing information on invoices. Therefore, the product will have both a Fixed price of 0 and a Usage based price.

Virtual data centers overview

Image: Virtual data centers overview.

Usage-based billing based on Ceilometers

The Atomia system collects usage information from OpenStack based on Ceilometer meters. Below we have listed the Ceilometers most commonly used in the Atomia system. However, there are many more available that can easily be translated into billing data in the Atomia system by following the examples below. Only make sure that the data exposed from Ceilometer is of the same scale as the counter in Atomia. The complete list of OpenStack measurements can be found here.

Instance meters

The instance meters count the run time of a certain type (flavor) of instance. In Ceilometer the meters are called instance: [type], for example instance:m1.tiny to count the usage of the m1.tiny flavor.

Counting incoming and outgoing traffic

For network traffic, we define two different counters; one for incoming and one for outgoing traffic. The price is defined per gigabyte.

Charging for disk usage

Disk usage is charged by millions of read/write requests. By default OpenStack comes with two meters that we utilise for this scenario; disk.read.requests and disk.write.requests. We define a different price for read and write requests. These can also be combined using Ceilometer sinks to create a new type of meter. Please consult the OpenStack manual.

Counting IP addresses

IP addresses are counted with the ceilometer meter ip.floating. To charge for IP addresses used per hour, a counter can be added.

Storage types used for volumes

With OpenStack you can offer different storage types for your volumes. This is supported in Atomia as well through a filter attribute to the counter id.

Atomia Billing plug-ins

There are two plugins in Atomia Billing that handles tasks related to virtual data centers:

  • UsageDataScheduledEventHandler: Handles the collection of usage data from Ceilometer and saves it as readable data for Atomia Billing.
  • PostPaidInvoiceScheduledEventHandler: Handles the creation of invoices.

Setting up Virtual Datacenters

Define the following criteria:

  • Provisioning service: VirtualDataCenter
  • Provisioning allowed: Allowed without payment
  • Product category: Virtual datacenter
  • Article number: VDC
  • Name and description: As per your request
  • Taxes: Your tax setup, usually RuleBasedTaxPlugin
  • Type of billing: Fixed price, nonrecurring price 0
  • Usage based price: Leave this unchecked, create the product and then proceed with the counter setup below

Setting up the billing counter

  1. Set up the following counter setup for your virtual data center in Atomia Billing. Make sure usage based price is checked.
    • Counter id: instance:m1.tiny
    • Counter name: Tiny instance
    • Counter description: A very tiny instance
    • Unit name: h
    • Measurement unit: 1.0
    • Ranges: At least 1 price range
  2. Set up one counter with your OpenStack installation for every flavor that you have available.

Setting up the network traffic counter

Useful tip

By default, OpenStack exposes the networking counters in bytes. By adding the following unit transformer, you receive the data in gigabytes.

    1. Add the following section to your /etc/ceilometer/pipeline.yaml file on the nodes in your OpenStack cloud:
- name: network_sink
  transformers:
      - name: "unit_conversion"
        parameters:
            source:
               map_from:
                   name: "network\\.(incoming|outgoing)\\.(bytes|packets)"
                   unit: "(B|packet)"
            target:
                map_to:
                    name: "network.\\1.\\2.gb"
                scale: "volume / 1024.0 / 1024.0 / 1024.0"
                unit: "gb"
  1. When network_sink is created, add a transformer to it that exposes new meters for network.incoming/outgoing.bytes.gb. Set up the following criteria:
    1. First counter
      • Counter id: network.outgoing.bytes.gb
      • Counter name: Outgoing network
      • Counter description: Outgoing network traffic
      • Unit name: gb
      • Measurement unit: 1.0
      • Ranges: At least 1 price range
  2. Second counter
    • Counter id: network.incoming.bytes.gb
    • Counter name: Incoming network
    • Counter description: Incoming network traffic
    • Unit name: gb
    • Measurement unit: 1.0
    • Ranges: At least 1 price range

Setting up the disk usage counter

Set up the disk usage counter as follows:

  1. First counter
    • Counter id: disk.read.requests
    • Counter name: Disk read requests
    • Counter description: Number of disk read requests
    • Unit name: requests
    • Measurement unit: 1000000
    • Ranges: At least 1 price range
  2. Second counter
    • Counter id: disk.write.requests
    • Counter name: Disk read requests
    • Counter description: Number of disk read requests
    • Unit name: requests
    • Measurement unit: 1000000
    • Ranges: At least 1 price range

Configuring floating IP addresses

Add the following counter to charge for IP addresses used per hour:

  • Counter id: ip.floating
  • Counter name: Floating ip addresses
  • Counter description: Number of floating ips
  • Unit name: ips
  • Measurement unit: 1
  • Ranges: At least 1 price range

Configuring storage volumes

Set up the following criteria for a storage type ssd (this is the name of the storage type in OpenStack):

  • Counter id: volume.size.filter:ssd
  • Counter name: SSD storage volume
  • Counter description: High performance SSD volumes
  • Unit name: gb
  • Measurement unit: 1
  • Ranges: At least 1 price range

Enabling billing plugins

  1. Go to Atomia Admin Panel > Settings > Scheduled tasks.
  2. Make sure that the scheduled tasks for UsageDataScheduledEventHandler and PostPaidInvoiceScheduledEventHandler are enabled.

Subscription-based billing

To add one or more products to Atomia Billing, simply add them with the following properties:

  • Provisioning service: VirtualDataCenter
  • Provisioning allowed: Allowed without payment
  • Product category: Virtual datacenter
  • Article number: VDC-SMALL
  • Name and description: As per your request
  • Taxes: Your tax setup, usually RuleBasedTaxPlugin
  • Type of billing: Fixed price, recurring and your price

Useful tip

It is possible to have several virtual data center products with different quota. This way you can offer your customers the possibility to upgrade or downgrade between the different sizes.

Modifying quota

    1. Open the OpenStack provisioning module configuration on the Automation Server machine on the path C:\Program Files (x86)\Atomia\AutomationServer\Common\Modules\Atomia.Provisioning.Modules.OpenStack.dll.config.
    2. Locate the section for VDCPackages that by default looks like below. This configuration defines the quota for three different products: VDC-SMALL, VDC-LARGE and VDC-MEDIUM.
'VDCPackages': [
{
  'name': 'VDCSMALL',
  'product_id': 'VDC-SMALL',
  'quota' : {
    'Cores': '5',
    'FloatingIPs': '5',
    'FixedIPs': '100',
    'InjectedFileContentBytes': '10240',
    'InjectedFilePathBytes': '255',
    'InjectedFiles': '10',
    'Instances': '10',
    'KeyPairs': '10',
    'Ram': '5000',
    'Networks': '10',
    'Ports': '10',
    'Routers': '10',
    'Subnets': '10',
    'Volumes': '10',
    'Snapshots': '10',
    'Gigabytes': '100' 
  },
  'upgrade_to': ['VDC-MEDIUM', 'VDC-LARGE'],
  'downgrade_to': []
},
{
  'name': 'VDCMEDIUM',
  'product_id': 'VDC-MEDIUM',
  'quota' : {
    'Cores': '15',
    'FloatingIPs': '15',
    'FixedIPs': '200',
    'InjectedFileContentBytes': '10240',
    'InjectedFilePathBytes': '255',
    'InjectedFiles': '10',
    'Instances': '10',
    'KeyPairs': '10',
    'Ram': '5000',
    'Networks': '10',
    'Ports': '10',
    'Routers': '10',
    'Subnets': '10',
    'Volumes': '10',
    'Snapshots': '10',
    'Gigabytes': '200' 
  },
  'upgrade_to': ['VDC-LARGE'],
  'downgrade_to': ['VDC-SMALL']
},
{
  'name': 'VDCLARGE',
  'product_id': 'VDC-LARGE',
  'quota' : {
    'Cores': '25',
    'FloatingIPs': '25',
    'FixedIPs': '300',
    'InjectedFileContentBytes': '10240',
    'InjectedFilePathBytes': '255',
    'InjectedFiles': '10',
    'Instances': '10',
    'KeyPairs': '10',
    'Ram': '5000',
    'Networks': '10',
    'Ports': '10',
    'Routers': '10',
    'Subnets': '10',
    'Volumes': '10',
    'Snapshots': '10',
    'Gigabytes': '400' 
  },
  'upgrade_to': [''],
  'downgrade_to': ['VDC-SMALL', 'VDC-MEDIUM']
}             
  1. Modify the setup to match the products you have created.
"ResellerMappings": [
  {
    "vdc_product_ids": ["VDC-SMALL", "VDC-MEDIUM", "VDC-LARGE"]
  }
]

Enabling subscription-based mode

  1. Open the VPS plugin configuration file in Hosting Control Panel on the path C:\Program Files (x86)\Atomia\HostingControlPanel\bin\Atomia.Web.Plugin.VPS.dll.config.
  2. Modify the plugin setting EnableUsageBasedVDC to false.

Was this helpful?