Ubuntu 24.04
Sponsored Link

OpenStack Caracal : How to use CloudKitty2024/05/23

 

This is how to use OpenStack Rating Service (CloudKitty).

This example is based on the environment like follows.

------------+--------------------------+--------------------------+------------
            |                          |                          |
        eth0|10.0.0.30             eth0|10.0.0.50             eth0|10.0.0.51
+-----------+-----------+  +-----------+-----------+  +-----------+-----------+
|   [ dlp.srv.world ]   |  | [ network.srv.world ] |  |  [ node01.srv.world ] |
|     (Control Node)    |  |     (Network Node)    |  |     (Compute Node)    |
|                       |  |                       |  |                       |
|  MariaDB    RabbitMQ  |  |  Neutron L2/L3 Agent  |  |        Libvirt        |
|  Memcached  Nginx     |  |   Neutron Metadata    |  |      Nova Compute     |
|  Keystone   httpd     |  |     Open vSwitch      |  |    Neutron L2 Agent   |
|  Glance     Nova API  |  |     iSCSI Target      |  |      Open vSwitch     |
|  Neutron Server       |  |     Cinder Volume     |  |   Ceilometer Compute  |
|  Neutron Metadata     |  |     httpd  Gnocchi    |  |                       |
|  Cinder API           |  |   Ceilometer Central  |  |                       |
|                       |  |     CloudKitty API    |  |                       |
+-----------------------+  +-----------------------+  +-----------------------+

[1] Add [cloudkitty] user in [rating] role for each project that you like to rate.
root@dlp ~(keystone)#
openstack project list

+----------------------------------+-----------+
| ID                               | Name      |
+----------------------------------+-----------+
| 18ede7365bdc430093e8fd4a90f77369 | hiroshima |
| 9c5145f76fd84324bdd2b1b61658a282 | admin     |
| ab9749e59bdb48e4807a18abb83c9f99 | service   |
+----------------------------------+-----------+

root@dlp ~(keystone)#
openstack role add --user cloudkitty --project hiroshima rating

[2] Enable [Hashmap] module.
root@dlp ~(keystone)#
openstack rating module list

+-----------+---------+----------+
| Module    | Enabled | Priority |
+-----------+---------+----------+
| hashmap   | False   |        1 |
| noop      | True    |        1 |
| pyscripts | False   |        1 |
+-----------+---------+----------+

root@dlp ~(keystone)#
openstack rating module enable hashmap

+---------+---------+----------+
| Module  | Enabled | Priority |
+---------+---------+----------+
| hashmap | True    |        1 |
+---------+---------+----------+

root@dlp ~(keystone)#
openstack rating module list

+-----------+---------+----------+
| Module    | Enabled | Priority |
+-----------+---------+----------+
| hashmap   | True    |        1 |
| noop      | True    |        1 |
| pyscripts | False   |        1 |
+-----------+---------+----------+
[3] Set rate to Instance Uptime.
When users in the project set on [1] create and start instances with [flavor_id] you set, target project is charged at the rate you set every interval of the [period] you set in [cloudkitty.conf].
# add service matching rule

root@dlp ~(keystone)#
openstack rating hashmap service create instance

+----------+--------------------------------------+
| Name     | Service ID                           |
+----------+--------------------------------------+
| instance | bcf7fd50-df0c-448f-b156-d9df88bc01a0 |
+----------+--------------------------------------+

# add field matching rule

root@dlp ~(keystone)#
openstack rating hashmap field create bcf7fd50-df0c-448f-b156-d9df88bc01a0 flavor_id

+-----------+--------------------------------+---------------------------------+
| Name      | Field ID                       | Service ID                      |
+-----------+--------------------------------+---------------------------------+
| flavor_id | 01d3df54-63d2-45e7-bd82-       | bcf7fd50-df0c-448f-b156-        |
|           | 7ca034f1e712                   | d9df88bc01a0                    |
+-----------+--------------------------------+---------------------------------+

root@dlp ~(keystone)#
openstack flavor list

+----+-----------+------+------+-----------+-------+-----------+
| ID | Name      |  RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+-----------+------+------+-----------+-------+-----------+
| 1  | m1.tiny   | 2048 |   10 |         0 |     1 | True      |
| 2  | m1.small  | 4096 |   10 |         0 |     2 | True      |
| 3  | m1.medium | 8192 |   10 |         0 |     4 | True      |
| 4  | m2.medium | 8192 |   10 |        10 |     4 | True      |
+----+-----------+------+------+-----------+-------+-----------+

# add mapping rule
# set a cost of [0.5] to instances with [flavor_id] = [2]
root@dlp ~(keystone)# openstack rating hashmap mapping create 0.5 \
--field-id 01d3df54-63d2-45e7-bd82-7ca034f1e712 \
--value 2 -t flat 
+------------+-------+----------+------+----------+------------+----------+------------+
| Mapping ID | Value | Cost     | Type | Field ID | Service ID | Group ID | Project ID |
+------------+-------+----------+------+----------+------------+----------+------------+
| 38f07b51-  | 2     | 0.500000 | flat | 01d3df54 | None       | None     | None       |
| 9a38-4af5- |       | 00000000 |      | -63d2-   |            |          |            |
| 880c-      |       | 00000000 |      | 45e7-    |            |          |            |
| 65c43b5bf3 |       | 000000   |      | bd82-    |            |          |            |
| d9         |       |          |      | 7ca034f1 |            |          |            |
|            |       |          |      | e712     |            |          |            |
+------------+-------+----------+------+----------+------------+----------+------------+
[4] Verify settings with an user who is in the project you set on [1] to create or start an instance.
ubuntu@dlp ~(keystone)$
openstack server list

+--------------+-------------+---------+--------------+------------+----------+
| ID           | Name        | Status  | Networks     | Image      | Flavor   |
+--------------+-------------+---------+--------------+------------+----------+
| 7fbc24c1-    | Ubuntu-2404 | SHUTOFF | private=10.0 | Ubuntu2404 | m1.small |
| c0d1-43d6-   |             |         | .0.208, 192. |            |          |
| 87aa-        |             |         | 168.100.130  |            |          |
| 68df83597b57 |             |         |              |            |          |
+--------------+-------------+---------+--------------+------------+----------+

ubuntu@dlp ~(keystone)$
openstack server start Ubuntu-2404
# after a certain period of time, costs are charged

ubuntu@dlp ~(keystone)$
openstack rating summary get

+-----------------+---------------+------+-----------------+-----------------+
| Tenant ID       | Resource Type | Rate | Begin Time      | End Time        |
+-----------------+---------------+------+-----------------+-----------------+
| 18ede7365bdc430 | ALL           | 0.5  | 2024-05-        | 2024-06-        |
| 093e8fd4a90f773 |               |      | 01T00:00:00     | 01T00:00:00     |
| 69              |               |      |                 |                 |
+-----------------+---------------+------+-----------------+-----------------+

# if the instance continues to run, costs are charged every [period] of time

ubuntu@dlp ~(keystone)$
openstack rating summary get

+-----------------+---------------+------+-----------------+-----------------+
| Tenant ID       | Resource Type | Rate | Begin Time      | End Time        |
+-----------------+---------------+------+-----------------+-----------------+
| 18ede7365bdc430 | ALL           | 1.0  | 2024-05-        | 2024-06-        |
| 093e8fd4a90f773 |               |      | 01T00:00:00     | 01T00:00:00     |
| 69              |               |      |                 |                 |
+-----------------+---------------+------+-----------------+-----------------+

# display data frames

ubuntu@dlp ~(keystone)$
openstack rating dataframes get

+------------------+------------------+------------------+---------------------+
| Begin            | End              | Project ID       | Resources           |
+------------------+------------------+------------------+---------------------+
| 2024-05-         | 2024-05-         | 18ede7365bdc4300 | [{'rating': '0.0',  |
| 23T01:10:00      | 23T01:20:00      | 93e8fd4a90f77369 | 'service':          |
|                  |                  |                  | 'instance', 'desc': |
|                  |                  |                  | {'flavor_name':     |
|                  |                  |                  | 'm1.small',         |
|                  |                  |                  | 'flavor_id': '2',   |
|                  |                  |                  | 'vcpus': '', 'id':  |
|                  |                  |                  | '7fbc24c1-c0d1-     |
|                  |                  |                  | 43d6-87aa-          |
|                  |                  |                  | 68df83597b57',      |
|                  |                  |                  | 'project_id': '18ed |
|                  |                  |                  | e7365bdc430093e8fd4 |
|                  |                  |                  | a90f77369',         |
|                  |                  |                  | 'user_id': 'b9371d0 |
|                  |                  |                  | 15e0d43dca74f291614 |
|                  |                  |                  | 48ffd2',            |
|                  |                  |                  | 'week_of_the_year': |
|                  |                  |                  | '20',               |
|                  |                  |                  | 'day_of_the_year':  |
|                  |                  |                  | '144', 'month':     |
|                  |                  |                  | '5', 'year':        |
|                  |                  |                  | '2024',             |
|                  |                  |                  | 'tenant_id': '18ede |
|                  |                  |                  | 7365bdc430093e8fd4a |
|                  |                  |                  | 90f77369'},         |
|                  |                  |                  | 'volume': '1',      |
|                  |                  |                  | 'rate_value':       |
|                  |                  |                  | '0.0000'}]          |
| 2024-05-         | 2024-05-         | 18ede7365bdc4300 | [{'rating': '0.0',  |
| 23T01:30:00      | 23T01:40:00      | 93e8fd4a90f77369 | 'service':          |
|                  |                  |                  | 'volume.size',      |
|                  |                  |                  | 'desc':             |
|                  |                  |                  | {'volume_type':     |
|                  |                  |                  | '__DEFAULT__',      |
|                  |                  |                  | 'id': 'f3515141-    |
|                  |                  |                  | 8e83-441d-b7e2-     |
|                  |                  |                  | 0136d8e1c0a7',      |
|                  |                  |                  | 'project_id': '18ed |
|                  |                  |                  | e7365bdc430093e8fd4 |
|                  |                  |                  | a90f77369',         |
|                  |                  |                  | 'user_id': 'b9371d0 |
|                  |                  |                  | 15e0d43dca74f291614 |
|                  |                  |                  | 48ffd2',            |
|                  |                  |                  | 'week_of_the_year': |
|                  |                  |                  | '20',               |
|                  |                  |                  | 'day_of_the_year':  |
|                  |                  |                  | '144', 'month':     |
|                  |                  |                  | '5', 'year':        |
|                  |                  |                  | '2024',             |
|                  |                  |                  | 'tenant_id': '18ede |
|                  |                  |                  | 7365bdc430093e8fd4a |
|                  |                  |                  | 90f77369'},         |
|                  |                  |                  | 'volume': '1E+1',   |
|                  |                  |                  | 'rate_value':       |
|                  |                  |                  | '0.0000'}]          |
| 2024-05-         | 2024-05-         | 18ede7365bdc4300 | [{'rating': '0.5',  |
| 23T01:50:00      | 23T02:00:00      | 93e8fd4a90f77369 | 'service':          |
|                  |                  |                  | 'instance', 'desc': |
|                  |                  |                  | {'flavor_name':     |
|                  |                  |                  | 'm1.small',         |
|                  |                  |                  | 'flavor_id': '2',   |
|                  |                  |                  | 'vcpus': '', 'id':  |
|                  |                  |                  | '7fbc24c1-c0d1-     |
|                  |                  |                  | 43d6-87aa-          |
|                  |                  |                  | 68df83597b57',      |
|                  |                  |                  | 'project_id': '18ed |
|                  |                  |                  | e7365bdc430093e8fd4 |
|                  |                  |                  | a90f77369',         |
|                  |                  |                  | 'user_id': 'b9371d0 |
|                  |                  |                  | 15e0d43dca74f291614 |
|                  |                  |                  | 48ffd2',            |
|                  |                  |                  | 'week_of_the_year': |
|                  |                  |                  | '20',               |
|                  |                  |                  | 'day_of_the_year':  |
|                  |                  |                  | '144', 'month':     |
|                  |                  |                  | '5', 'year':        |
|                  |                  |                  | '2024',             |
|                  |                  |                  | 'tenant_id': '18ede |
|                  |                  |                  | 7365bdc430093e8fd4a |
|                  |                  |                  | 90f77369'},         |
|                  |                  |                  | 'volume': '1',      |
|                  |                  |                  | 'rate_value':       |
|                  |                  |                  | '0.5000'}]          |
| 2024-05-         | 2024-05-         | 18ede7365bdc4300 | [{'rating': '0.5',  |
| 23T02:00:00      | 23T02:10:00      | 93e8fd4a90f77369 | 'service':          |
|                  |                  |                  | 'instance', 'desc': |
|                  |                  |                  | {'flavor_name':     |
|                  |                  |                  | 'm1.small',         |
|                  |                  |                  | 'flavor_id': '2',   |
|                  |                  |                  | 'vcpus': '', 'id':  |
|                  |                  |                  | '7fbc24c1-c0d1-     |
|                  |                  |                  | 43d6-87aa-          |
|                  |                  |                  | 68df83597b57',      |
|                  |                  |                  | 'project_id': '18ed |
|                  |                  |                  | e7365bdc430093e8fd4 |
|                  |                  |                  | a90f77369',         |
|                  |                  |                  | 'user_id': 'b9371d0 |
|                  |                  |                  | 15e0d43dca74f291614 |
|                  |                  |                  | 48ffd2',            |
|                  |                  |                  | 'week_of_the_year': |
|                  |                  |                  | '20',               |
|                  |                  |                  | 'day_of_the_year':  |
|                  |                  |                  | '144', 'month':     |
|                  |                  |                  | '5', 'year':        |
|                  |                  |                  | '2024',             |
|                  |                  |                  | 'tenant_id': '18ede |
|                  |                  |                  | 7365bdc430093e8fd4a |
|                  |                  |                  | 90f77369'},         |
|                  |                  |                  | 'volume': '1',      |
|                  |                  |                  | 'rate_value':       |
|                  |                  |                  | '0.5000'}]          |
+------------------+------------------+------------------+---------------------+
[5] Set rate to Volume Size.
When users in the project set on [1] create cinder volumes, target project is charged at the rate you set per gigabyte.
# add service matching rule

root@dlp ~(keystone)#
openstack rating hashmap service create volume.size

+-------------+--------------------------------------+
| Name        | Service ID                           |
+-------------+--------------------------------------+
| volume.size | f5ef8afc-80d9-4ca4-9d9b-935359f4dab7 |
+-------------+--------------------------------------+

# add mapping rule
# set a cost of [1.5] per gigabyte
root@dlp ~(keystone)# openstack rating hashmap mapping create 1.5 \
-s f5ef8afc-80d9-4ca4-9d9b-935359f4dab7 \
-t flat 
+------------+-------+----------+------+----------+------------+----------+------------+
| Mapping ID | Value | Cost     | Type | Field ID | Service ID | Group ID | Project ID |
+------------+-------+----------+------+----------+------------+----------+------------+
| dff6593b-  | None  | 1.500000 | flat | None     | f5ef8afc-  | None     | None       |
| bdc9-42ec- |       | 00000000 |      |          | 80d9-4ca4- |          |            |
| a4f0-      |       | 00000000 |      |          | 9d9b-      |          |            |
| 864201dad2 |       | 000000   |      |          | 935359f4da |          |            |
| c8         |       |          |      |          | b7         |          |            |
+------------+-------+----------+------+----------+------------+----------+------------+

# set a 10% discount on over 30 GB volumes
root@dlp ~(keystone)# openstack rating hashmap threshold create 30 0.90 \
-s f5ef8afc-80d9-4ca4-9d9b-935359f4dab7 \
-t rate 
+--------------+----------+----------+------+----------+------------+----------+------------+
| Threshold ID | Level    | Cost     | Type | Field ID | Service ID | Group ID | Project ID |
+--------------+----------+----------+------+----------+------------+----------+------------+
| 7beb63cf-    | 30.00000 | 0.900000 | rate | None     | f5ef8afc-  | None     | None       |
| 9f66-4abe-   | 000      | 00000000 |      |          | 80d9-4ca4- |          |            |
| 9b01-        |          | 00222044 |      |          | 9d9b-      |          |            |
| 81cf81f04d17 |          | 604925   |      |          | 935359f4da |          |            |
|              |          |          |      |          | b7         |          |            |
+--------------+----------+----------+------+----------+------------+----------+------------+
[6] Verify settings with an user who is in the project you set on [1] to create volumes.
ubuntu@dlp ~(keystone)$
openstack rating summary get

+-----------------+---------------+------+-----------------+-----------------+
| Tenant ID       | Resource Type | Rate | Begin Time      | End Time        |
+-----------------+---------------+------+-----------------+-----------------+
| 18ede7365bdc430 | ALL           | 1.5  | 2024-05-        | 2024-06-        |
| 093e8fd4a90f773 |               |      | 01T00:00:00     | 01T00:00:00     |
| 69              |               |      |                 |                 |
+-----------------+---------------+------+-----------------+-----------------+

ubuntu@dlp ~(keystone)$ openstack volume create --size 10 disk01 

ubuntu@dlp ~(keystone)$
openstack volume list

+------------------------------------+--------+-----------+------+-------------+
| ID                                 | Name   | Status    | Size | Attached to |
+------------------------------------+--------+-----------+------+-------------+
| be53c7f4-7574-45cd-8020-           | disk01 | available |   10 |             |
| 1d09fcd47945                       |        |           |      |             |
+------------------------------------+--------+-----------+------+-------------+

# after a certain period of time, costs are charged

ubuntu@dlp ~(keystone)$
openstack rating summary get

+-----------------+---------------+------+-----------------+-----------------+
| Tenant ID       | Resource Type | Rate | Begin Time      | End Time        |
+-----------------+---------------+------+-----------------+-----------------+
| 18ede7365bdc430 | ALL           | 16.5 | 2024-05-        | 2024-06-        |
| 093e8fd4a90f773 |               |      | 01T00:00:00     | 01T00:00:00     |
| 69              |               |      |                 |                 |
+-----------------+---------------+------+-----------------+-----------------+

ubuntu@dlp ~(keystone)$
openstack rating dataframes get

+------------------+------------------+------------------+---------------------+
| Begin            | End              | Project ID       | Resources           |
+------------------+------------------+------------------+---------------------+
| 2024-05-         | 2024-05-         | 18ede7365bdc4300 | [{'rating': '0.0',  |
| 23T01:10:00      | 23T01:20:00      | 93e8fd4a90f77369 | 'service':          |
|                  |                  |                  | 'instance', 'desc': |
|                  |                  |                  | {'flavor_name':     |
|                  |                  |                  | 'm1.small',         |
|                  |                  |                  | 'flavor_id': '2',   |
|                  |                  |                  | 'vcpus': '', 'id':  |
|                  |                  |                  | '7fbc24c1-c0d1-     |
|                  |                  |                  | 43d6-87aa-          |
|                  |                  |                  | 68df83597b57',      |
|                  |                  |                  | 'project_id': '18ed |
|                  |                  |                  | e7365bdc430093e8fd4 |
|                  |                  |                  | a90f77369',         |
|                  |                  |                  | 'user_id': 'b9371d0 |
|                  |                  |                  | 15e0d43dca74f291614 |
|                  |                  |                  | 48ffd2',            |
|                  |                  |                  | 'week_of_the_year': |
|                  |                  |                  | '20',               |
|                  |                  |                  | 'day_of_the_year':  |
|                  |                  |                  | '144', 'month':     |
|                  |                  |                  | '5', 'year':        |
|                  |                  |                  | '2024',             |
|                  |                  |                  | 'tenant_id': '18ede |
|                  |                  |                  | 7365bdc430093e8fd4a |
|                  |                  |                  | 90f77369'},         |
|                  |                  |                  | 'volume': '1',      |
|                  |                  |                  | 'rate_value':       |
|                  |                  |                  | '0.0000'}]          |
| 2024-05-         | 2024-05-         | 18ede7365bdc4300 | [{'rating': '0.0',  |
| 23T01:30:00      | 23T01:40:00      | 93e8fd4a90f77369 | 'service':          |
|                  |                  |                  | 'volume.size',      |
|                  |                  |                  | 'desc':             |
|                  |                  |                  | {'volume_type':     |
|                  |                  |                  | '__DEFAULT__',      |
|                  |                  |                  | 'id': 'f3515141-    |
|                  |                  |                  | 8e83-441d-b7e2-     |
|                  |                  |                  | 0136d8e1c0a7',      |
|                  |                  |                  | 'project_id': '18ed |
|                  |                  |                  | e7365bdc430093e8fd4 |
|                  |                  |                  | a90f77369',         |
|                  |                  |                  | 'user_id': 'b9371d0 |
|                  |                  |                  | 15e0d43dca74f291614 |
|                  |                  |                  | 48ffd2',            |
|                  |                  |                  | 'week_of_the_year': |
|                  |                  |                  | '20',               |
|                  |                  |                  | 'day_of_the_year':  |
|                  |                  |                  | '144', 'month':     |
|                  |                  |                  | '5', 'year':        |
|                  |                  |                  | '2024',             |
|                  |                  |                  | 'tenant_id': '18ede |
|                  |                  |                  | 7365bdc430093e8fd4a |
|                  |                  |                  | 90f77369'},         |
|                  |                  |                  | 'volume': '1E+1',   |
|                  |                  |                  | 'rate_value':       |
|                  |                  |                  | '0.0000'}]          |
| 2024-05-         | 2024-05-         | 18ede7365bdc4300 | [{'rating': '0.5',  |
| 23T01:50:00      | 23T02:00:00      | 93e8fd4a90f77369 | 'service':          |
|                  |                  |                  | 'instance', 'desc': |
|                  |                  |                  | {'flavor_name':     |
|                  |                  |                  | 'm1.small',         |
|                  |                  |                  | 'flavor_id': '2',   |
|                  |                  |                  | 'vcpus': '', 'id':  |
|                  |                  |                  | '7fbc24c1-c0d1-     |
|                  |                  |                  | 43d6-87aa-          |
|                  |                  |                  | 68df83597b57',      |
|                  |                  |                  | 'project_id': '18ed |
|                  |                  |                  | e7365bdc430093e8fd4 |
|                  |                  |                  | a90f77369',         |
|                  |                  |                  | 'user_id': 'b9371d0 |
|                  |                  |                  | 15e0d43dca74f291614 |
|                  |                  |                  | 48ffd2',            |
|                  |                  |                  | 'week_of_the_year': |
|                  |                  |                  | '20',               |
|                  |                  |                  | 'day_of_the_year':  |
|                  |                  |                  | '144', 'month':     |
|                  |                  |                  | '5', 'year':        |
|                  |                  |                  | '2024',             |
|                  |                  |                  | 'tenant_id': '18ede |
|                  |                  |                  | 7365bdc430093e8fd4a |
|                  |                  |                  | 90f77369'},         |
|                  |                  |                  | 'volume': '1',      |
|                  |                  |                  | 'rate_value':       |
|                  |                  |                  | '0.5000'}]          |
| 2024-05-         | 2024-05-         | 18ede7365bdc4300 | [{'rating': '0.5',  |
| 23T02:00:00      | 23T02:10:00      | 93e8fd4a90f77369 | 'service':          |
|                  |                  |                  | 'instance', 'desc': |
|                  |                  |                  | {'flavor_name':     |
|                  |                  |                  | 'm1.small',         |
|                  |                  |                  | 'flavor_id': '2',   |
|                  |                  |                  | 'vcpus': '', 'id':  |
|                  |                  |                  | '7fbc24c1-c0d1-     |
|                  |                  |                  | 43d6-87aa-          |
|                  |                  |                  | 68df83597b57',      |
|                  |                  |                  | 'project_id': '18ed |
|                  |                  |                  | e7365bdc430093e8fd4 |
|                  |                  |                  | a90f77369',         |
|                  |                  |                  | 'user_id': 'b9371d0 |
|                  |                  |                  | 15e0d43dca74f291614 |
|                  |                  |                  | 48ffd2',            |
|                  |                  |                  | 'week_of_the_year': |
|                  |                  |                  | '20',               |
|                  |                  |                  | 'day_of_the_year':  |
|                  |                  |                  | '144', 'month':     |
|                  |                  |                  | '5', 'year':        |
|                  |                  |                  | '2024',             |
|                  |                  |                  | 'tenant_id': '18ede |
|                  |                  |                  | 7365bdc430093e8fd4a |
|                  |                  |                  | 90f77369'},         |
|                  |                  |                  | 'volume': '1',      |
|                  |                  |                  | 'rate_value':       |
|                  |                  |                  | '0.5000'}]          |
| 2024-05-         | 2024-05-         | 18ede7365bdc4300 | [{'rating': '0.5',  |
| 23T02:10:00      | 23T02:20:00      | 93e8fd4a90f77369 | 'service':          |
|                  |                  |                  | 'instance', 'desc': |
|                  |                  |                  | {'flavor_name':     |
|                  |                  |                  | 'm1.small',         |
|                  |                  |                  | 'flavor_id': '2',   |
|                  |                  |                  | 'vcpus': '', 'id':  |
|                  |                  |                  | '7fbc24c1-c0d1-     |
|                  |                  |                  | 43d6-87aa-          |
|                  |                  |                  | 68df83597b57',      |
|                  |                  |                  | 'project_id': '18ed |
|                  |                  |                  | e7365bdc430093e8fd4 |
|                  |                  |                  | a90f77369',         |
|                  |                  |                  | 'user_id': 'b9371d0 |
|                  |                  |                  | 15e0d43dca74f291614 |
|                  |                  |                  | 48ffd2',            |
|                  |                  |                  | 'week_of_the_year': |
|                  |                  |                  | '20',               |
|                  |                  |                  | 'day_of_the_year':  |
|                  |                  |                  | '144', 'month':     |
|                  |                  |                  | '5', 'year':        |
|                  |                  |                  | '2024',             |
|                  |                  |                  | 'tenant_id': '18ede |
|                  |                  |                  | 7365bdc430093e8fd4a |
|                  |                  |                  | 90f77369'},         |
|                  |                  |                  | 'volume': '1',      |
|                  |                  |                  | 'rate_value':       |
|                  |                  |                  | '0.5000'}]          |
| 2024-05-         | 2024-05-         | 18ede7365bdc4300 | [{'rating': '15.0', |
| 23T03:20:00      | 23T03:30:00      | 93e8fd4a90f77369 | 'service':          |
|                  |                  |                  | 'volume.size',      |
|                  |                  |                  | 'desc':             |
|                  |                  |                  | {'volume_type':     |
|                  |                  |                  | '__DEFAULT__',      |
|                  |                  |                  | 'id': 'be53c7f4-    |
|                  |                  |                  | 7574-45cd-8020-     |
|                  |                  |                  | 1d09fcd47945',      |
|                  |                  |                  | 'project_id': '18ed |
|                  |                  |                  | e7365bdc430093e8fd4 |
|                  |                  |                  | a90f77369',         |
|                  |                  |                  | 'user_id': 'b9371d0 |
|                  |                  |                  | 15e0d43dca74f291614 |
|                  |                  |                  | 48ffd2',            |
|                  |                  |                  | 'week_of_the_year': |
|                  |                  |                  | '20',               |
|                  |                  |                  | 'day_of_the_year':  |
|                  |                  |                  | '144', 'month':     |
|                  |                  |                  | '5', 'year':        |
|                  |                  |                  | '2024',             |
|                  |                  |                  | 'tenant_id': '18ede |
|                  |                  |                  | 7365bdc430093e8fd4a |
|                  |                  |                  | 90f77369'},         |
|                  |                  |                  | 'volume': '1E+1',   |
|                  |                  |                  | 'rate_value':       |
|                  |                  |                  | '1.5000'}]          |
+------------------+------------------+------------------+---------------------+

ubuntu@dlp ~(keystone)$
openstack volume create --size 30 disk02

ubuntu@dlp ~(keystone)$
openstack volume list

+------------------------------------+--------+-----------+------+-------------+
| ID                                 | Name   | Status    | Size | Attached to |
+------------------------------------+--------+-----------+------+-------------+
| c5a797ab-e638-4cb8-94bf-           | disk02 | available |   30 |             |
| 2fb185878626                       |        |           |      |             |
| be53c7f4-7574-45cd-8020-           | disk01 | available |   10 |             |
| 1d09fcd47945                       |        |           |      |             |
+------------------------------------+--------+-----------+------+-------------+

# after a certain period of time, costs are charged
# 1.5 x 30 x 0.9 = 40.5

ubuntu@dlp ~(keystone)$
openstack rating summary get

+-----------------+---------------+------+-----------------+-----------------+
| Tenant ID       | Resource Type | Rate | Begin Time      | End Time        |
+-----------------+---------------+------+-----------------+-----------------+
| 18ede7365bdc430 | ALL           | 57.0 | 2024-05-        | 2024-06-        |
| 093e8fd4a90f773 |               |      | 01T00:00:00     | 01T00:00:00     |
| 69              |               |      |                 |                 |
+-----------------+---------------+------+-----------------+-----------------+

ubuntu@dlp ~(keystone)$
openstack rating dataframes get

+------------------+------------------+------------------+---------------------+
| Begin            | End              | Project ID       | Resources           |
+------------------+------------------+------------------+---------------------+
| 2024-05-         | 2024-05-         | 18ede7365bdc4300 | [{'rating': '0.0',  |
| 23T01:10:00      | 23T01:20:00      | 93e8fd4a90f77369 | 'service':          |
|                  |                  |                  | 'instance', 'desc': |
|                  |                  |                  | {'flavor_name':     |
|                  |                  |                  | 'm1.small',         |
|                  |                  |                  | 'flavor_id': '2',   |
|                  |                  |                  | 'vcpus': '', 'id':  |
|                  |                  |                  | '7fbc24c1-c0d1-     |
|                  |                  |                  | 43d6-87aa-          |
|                  |                  |                  | 68df83597b57',      |
|                  |                  |                  | 'project_id': '18ed |
|                  |                  |                  | e7365bdc430093e8fd4 |
|                  |                  |                  | a90f77369',         |
|                  |                  |                  | 'user_id': 'b9371d0 |
|                  |                  |                  | 15e0d43dca74f291614 |
|                  |                  |                  | 48ffd2',            |
|                  |                  |                  | 'week_of_the_year': |
|                  |                  |                  | '20',               |
|                  |                  |                  | 'day_of_the_year':  |
|                  |                  |                  | '144', 'month':     |
|                  |                  |                  | '5', 'year':        |
|                  |                  |                  | '2024',             |
|                  |                  |                  | 'tenant_id': '18ede |
|                  |                  |                  | 7365bdc430093e8fd4a |
|                  |                  |                  | 90f77369'},         |
|                  |                  |                  | 'volume': '1',      |
|                  |                  |                  | 'rate_value':       |
|                  |                  |                  | '0.0000'}]          |
| 2024-05-         | 2024-05-         | 18ede7365bdc4300 | [{'rating': '0.0',  |
| 23T01:30:00      | 23T01:40:00      | 93e8fd4a90f77369 | 'service':          |
|                  |                  |                  | 'volume.size',      |
|                  |                  |                  | 'desc':             |
|                  |                  |                  | {'volume_type':     |
|                  |                  |                  | '__DEFAULT__',      |
|                  |                  |                  | 'id': 'f3515141-    |
|                  |                  |                  | 8e83-441d-b7e2-     |
|                  |                  |                  | 0136d8e1c0a7',      |
|                  |                  |                  | 'project_id': '18ed |
|                  |                  |                  | e7365bdc430093e8fd4 |
|                  |                  |                  | a90f77369',         |
|                  |                  |                  | 'user_id': 'b9371d0 |
|                  |                  |                  | 15e0d43dca74f291614 |
|                  |                  |                  | 48ffd2',            |
|                  |                  |                  | 'week_of_the_year': |
|                  |                  |                  | '20',               |
|                  |                  |                  | 'day_of_the_year':  |
|                  |                  |                  | '144', 'month':     |
|                  |                  |                  | '5', 'year':        |
|                  |                  |                  | '2024',             |
|                  |                  |                  | 'tenant_id': '18ede |
|                  |                  |                  | 7365bdc430093e8fd4a |
|                  |                  |                  | 90f77369'},         |
|                  |                  |                  | 'volume': '1E+1',   |
|                  |                  |                  | 'rate_value':       |
|                  |                  |                  | '0.0000'}]          |
| 2024-05-         | 2024-05-         | 18ede7365bdc4300 | [{'rating': '0.5',  |
| 23T01:50:00      | 23T02:00:00      | 93e8fd4a90f77369 | 'service':          |
|                  |                  |                  | 'instance', 'desc': |
|                  |                  |                  | {'flavor_name':     |
|                  |                  |                  | 'm1.small',         |
|                  |                  |                  | 'flavor_id': '2',   |
|                  |                  |                  | 'vcpus': '', 'id':  |
|                  |                  |                  | '7fbc24c1-c0d1-     |
|                  |                  |                  | 43d6-87aa-          |
|                  |                  |                  | 68df83597b57',      |
|                  |                  |                  | 'project_id': '18ed |
|                  |                  |                  | e7365bdc430093e8fd4 |
|                  |                  |                  | a90f77369',         |
|                  |                  |                  | 'user_id': 'b9371d0 |
|                  |                  |                  | 15e0d43dca74f291614 |
|                  |                  |                  | 48ffd2',            |
|                  |                  |                  | 'week_of_the_year': |
|                  |                  |                  | '20',               |
|                  |                  |                  | 'day_of_the_year':  |
|                  |                  |                  | '144', 'month':     |
|                  |                  |                  | '5', 'year':        |
|                  |                  |                  | '2024',             |
|                  |                  |                  | 'tenant_id': '18ede |
|                  |                  |                  | 7365bdc430093e8fd4a |
|                  |                  |                  | 90f77369'},         |
|                  |                  |                  | 'volume': '1',      |
|                  |                  |                  | 'rate_value':       |
|                  |                  |                  | '0.5000'}]          |
| 2024-05-         | 2024-05-         | 18ede7365bdc4300 | [{'rating': '0.5',  |
| 23T02:00:00      | 23T02:10:00      | 93e8fd4a90f77369 | 'service':          |
|                  |                  |                  | 'instance', 'desc': |
|                  |                  |                  | {'flavor_name':     |
|                  |                  |                  | 'm1.small',         |
|                  |                  |                  | 'flavor_id': '2',   |
|                  |                  |                  | 'vcpus': '', 'id':  |
|                  |                  |                  | '7fbc24c1-c0d1-     |
|                  |                  |                  | 43d6-87aa-          |
|                  |                  |                  | 68df83597b57',      |
|                  |                  |                  | 'project_id': '18ed |
|                  |                  |                  | e7365bdc430093e8fd4 |
|                  |                  |                  | a90f77369',         |
|                  |                  |                  | 'user_id': 'b9371d0 |
|                  |                  |                  | 15e0d43dca74f291614 |
|                  |                  |                  | 48ffd2',            |
|                  |                  |                  | 'week_of_the_year': |
|                  |                  |                  | '20',               |
|                  |                  |                  | 'day_of_the_year':  |
|                  |                  |                  | '144', 'month':     |
|                  |                  |                  | '5', 'year':        |
|                  |                  |                  | '2024',             |
|                  |                  |                  | 'tenant_id': '18ede |
|                  |                  |                  | 7365bdc430093e8fd4a |
|                  |                  |                  | 90f77369'},         |
|                  |                  |                  | 'volume': '1',      |
|                  |                  |                  | 'rate_value':       |
|                  |                  |                  | '0.5000'}]          |
| 2024-05-         | 2024-05-         | 18ede7365bdc4300 | [{'rating': '0.5',  |
| 23T02:10:00      | 23T02:20:00      | 93e8fd4a90f77369 | 'service':          |
|                  |                  |                  | 'instance', 'desc': |
|                  |                  |                  | {'flavor_name':     |
|                  |                  |                  | 'm1.small',         |
|                  |                  |                  | 'flavor_id': '2',   |
|                  |                  |                  | 'vcpus': '', 'id':  |
|                  |                  |                  | '7fbc24c1-c0d1-     |
|                  |                  |                  | 43d6-87aa-          |
|                  |                  |                  | 68df83597b57',      |
|                  |                  |                  | 'project_id': '18ed |
|                  |                  |                  | e7365bdc430093e8fd4 |
|                  |                  |                  | a90f77369',         |
|                  |                  |                  | 'user_id': 'b9371d0 |
|                  |                  |                  | 15e0d43dca74f291614 |
|                  |                  |                  | 48ffd2',            |
|                  |                  |                  | 'week_of_the_year': |
|                  |                  |                  | '20',               |
|                  |                  |                  | 'day_of_the_year':  |
|                  |                  |                  | '144', 'month':     |
|                  |                  |                  | '5', 'year':        |
|                  |                  |                  | '2024',             |
|                  |                  |                  | 'tenant_id': '18ede |
|                  |                  |                  | 7365bdc430093e8fd4a |
|                  |                  |                  | 90f77369'},         |
|                  |                  |                  | 'volume': '1',      |
|                  |                  |                  | 'rate_value':       |
|                  |                  |                  | '0.5000'}]          |
| 2024-05-         | 2024-05-         | 18ede7365bdc4300 | [{'rating': '15.0', |
| 23T03:20:00      | 23T03:30:00      | 93e8fd4a90f77369 | 'service':          |
|                  |                  |                  | 'volume.size',      |
|                  |                  |                  | 'desc':             |
|                  |                  |                  | {'volume_type':     |
|                  |                  |                  | '__DEFAULT__',      |
|                  |                  |                  | 'id': 'be53c7f4-    |
|                  |                  |                  | 7574-45cd-8020-     |
|                  |                  |                  | 1d09fcd47945',      |
|                  |                  |                  | 'project_id': '18ed |
|                  |                  |                  | e7365bdc430093e8fd4 |
|                  |                  |                  | a90f77369',         |
|                  |                  |                  | 'user_id': 'b9371d0 |
|                  |                  |                  | 15e0d43dca74f291614 |
|                  |                  |                  | 48ffd2',            |
|                  |                  |                  | 'week_of_the_year': |
|                  |                  |                  | '20',               |
|                  |                  |                  | 'day_of_the_year':  |
|                  |                  |                  | '144', 'month':     |
|                  |                  |                  | '5', 'year':        |
|                  |                  |                  | '2024',             |
|                  |                  |                  | 'tenant_id': '18ede |
|                  |                  |                  | 7365bdc430093e8fd4a |
|                  |                  |                  | 90f77369'},         |
|                  |                  |                  | 'volume': '1E+1',   |
|                  |                  |                  | 'rate_value':       |
|                  |                  |                  | '1.5000'}]          |
| 2024-05-         | 2024-05-         | 18ede7365bdc4300 | [{'rating': '40.5', |
| 23T03:20:00      | 23T03:30:00      | 93e8fd4a90f77369 | 'service':          |
|                  |                  |                  | 'volume.size',      |
|                  |                  |                  | 'desc':             |
|                  |                  |                  | {'volume_type':     |
|                  |                  |                  | '__DEFAULT__',      |
|                  |                  |                  | 'id': 'c5a797ab-    |
|                  |                  |                  | e638-4cb8-94bf-     |
|                  |                  |                  | 2fb185878626',      |
|                  |                  |                  | 'project_id': '18ed |
|                  |                  |                  | e7365bdc430093e8fd4 |
|                  |                  |                  | a90f77369',         |
|                  |                  |                  | 'user_id': 'b9371d0 |
|                  |                  |                  | 15e0d43dca74f291614 |
|                  |                  |                  | 48ffd2',            |
|                  |                  |                  | 'week_of_the_year': |
|                  |                  |                  | '20',               |
|                  |                  |                  | 'day_of_the_year':  |
|                  |                  |                  | '144', 'month':     |
|                  |                  |                  | '5', 'year':        |
|                  |                  |                  | '2024',             |
|                  |                  |                  | 'tenant_id': '18ede |
|                  |                  |                  | 7365bdc430093e8fd4a |
|                  |                  |                  | 90f77369'},         |
|                  |                  |                  | 'volume': '3E+1',   |
|                  |                  |                  | 'rate_value':       |
|                  |                  |                  | '1.3500'}]          |
+------------------+------------------+------------------+---------------------+
Matched Content