当前位置 : 主页 > 编程语言 > 其它开发 >

OpenStack计费服务

来源:互联网 收集:自由互联 发布时间:2022-05-14
cloudkitty服务介绍 当前版本cloudkitty可以完成虚拟机实例(compute),云硬盘(volume),镜像(image),网络进出流量(network.bw.in,network.bw.out),浮动IP(network.floating)的计费。得益于Cl

cloudkitty服务介绍
当前版本cloudkitty可以完成虚拟机实例(compute),云硬盘(volume),镜像(image),网络进出流量(network.bw.in,network.bw.out),浮动IP(network.floating)的计费。得益于Cloudkitty的巧妙而优秀的设计,软件插件化思想更是体现的淋漓尽致,使得添加新的计费源异常容易,版本升级十分方便。同样也能方便将cloudkitty用于cloudstack,VMWare等环境中。

Cloudkitty主要依赖于遥测相关的项目,包括ceilometer和gnocchi,甚至是将要使用panko;计费策略和hashmap计费模型是其核心;模块插件化是其设计灵魂;

使用命令编辑/etc/openstack/openrc.sh配置文件,添加Cloudkitty环境变量参数

##--------------------Cloudkitty Config----------------##
##Password for Mysql Cloudkitty user. exmaple:000000
CLOUDKITTY_DBPASS=000000

##Password for Keystore Cloudkitty user. exmaple:000000
CLOUDKITTY_PASS=000000

使用CRT等远程连接工具,连接至172.30.17.14控制节点,执行iaas-install- cloudkitty.sh安装脚本

[root@controller ~]# iaas-install-cloudkitty.sh
实例类型收费

创建云主机服务instance_test,通过命令创建service服务

[root@controller ~]# openstack rating hashmap service create instance_test
+---------------+--------------------------------------+
| Name          | Service ID                           |
+---------------+--------------------------------------+
| instance_test | cf8029bf-dc35-4e40-b8fd-5af4a4d25a30 |
+---------------+--------------------------------------+

并对其创建名为flavor_name的fields

[root@controller ~]# openstack rating hashmap field create cf8029bf-dc35-4e40-b8fd-5af4a4d25a30 flavor_name
+-------------+--------------------------------------+--------------------------------------+
| Name        | Field ID                             | Service ID                           |
+-------------+--------------------------------------+--------------------------------------+
| flavor_name | b2f0d485-df20-4f2e-bd44-d3696971cb8f | cf8029bf-dc35-4e40-b8fd-5af4a4d25a30 |
+-------------+--------------------------------------+--------------------------------------+

并设置规格为m1.small的云主机单价为1元

[root@controller ~]# openstack rating hashmap mapping create  --field-id b2f0d485-df20-4f2e-bd44-d3696971cb8f  -t flat --value  m1.small 1
+--------------------+--------+----------+----+--------------------+----------+--------+----------+
| Mapping ID         |Value   |Cost      |Type| Field ID           |Service ID|Group ID|Project ID|
+--------------------+--------+----------+----+--------------------+----------+--------+----------+
| c1b7d4db-c1d2-4488 |m1.small|1.00000000|flat| b2f0d485-df20-4f2e | None     | None   | None     |
  -ac46-1a8eb70d76e4                            -bd44-d3696971cb8f
+--------------------+--------+----------+----+--------------------+----------+--------+----------+
镜像服务费用

创建镜像收费服务image_size_test

[root@controller ~]# openstack rating hashmap service create image_size_test
+-----------------+--------------------------------------+
| Name            | Service ID                           |
+-----------------+--------------------------------------+
| image_size_test | 80a098cf-d793-47cf-b63e-df6cbd56e88d |
+-----------------+--------------------------------------+

并为该服务单价设置为0.8元

[root@controller ~]# openstack rating hashmap mapping create -s  80a098cf-d793-47cf-b63e-df6cbd56e88d   -t flat 0.8 
+--------------------+-------+------------+------+----------+--------------------+--------+----------+
| Mapping ID         | Value | Cost       | Type | Field ID | Service ID         |Group ID|Project ID|
+--------------------+-------+------------+------+----------+--------------------+--------+----------+
| 64952e70-6e37-4c8a | None  | 0.80000000 | flat | None     | 80a098cf-d793-47cf | None   | None     |
  -9d3a-b4c70de1fb87                                          -b63e-df6cbd56e88d
+--------------------+-------+------------+------+----------+--------------------+--------+----------
创建优惠服务

创建名为dis_tests的服务

[root@controller ~]# openstack rating hashmap service create dis_tests
+-----------+--------------------------------------+
| Name      | Service ID                           |
+-----------+--------------------------------------+
| dis_tests | b6190077-80ff-4e1f-9938-ddaff11c3506 |
+-----------+--------------------------------------+

为dis_tests服务设置单价为0.8元

[root@controller ~]# openstack rating hashmap mapping create -s  b6190077-80ff-4e1f-9938-ddaff11c3506  -t flat 0.8
+--------------------+-------+------------+----+--------+--------------------+----------+------------+
| Mapping ID         | Value | Cost       |Type|Field ID| Service ID         | Group ID | Project ID |
+--------------------+-------+------------+----+--------+--------------------+----------+------------+
| f5a51b26-82f8-45a4 | None  | 0.80000000 |flat| None   | b6190077-80ff-4e1f | None     | None       |
  -8784-f7f131c2e4cd                                      -9938-ddaff11c3506
+--------------------+-------+------------+----+--------+--------------------+----------+------------+

并设置dis_tests服务使用量超过10000时提供8折优惠

[root@controller ~]# openstack rating hashmap threshold create -s b6190077-80ff-4e1f-9938-ddaff11c3506 -t rate 10000 0.8
+-------------------+--------------+----------+----+--------+--------------------+--------+----------+
| Threshold ID      | Level        |Cost      |Type|Field ID| Service ID         |Group ID|Project ID|
+-------------------+--------------+----------+----+--------+--------------------+--------+----------+
|11be2ecb-b7fa-42cd |10000.00000000|0.80000000|rate| None   | b6190077-80ff-4e1f | None   | None     |
 -a8d1-a0b679181912                                           -9938-ddaff11c3506
+-------------------+--------------+----------+----+--------+--------------------+--------+----------+
上一篇:SICP 2.2: 层次性数据和闭包性质(Python实现)
下一篇:没有了
网友评论