cinder的qos限速

16 篇文章 0 订阅
13 篇文章 0 订阅

作者 吴业亮

Cinder 支持 front-end 端和 back-end 端设置 QoS,其中 front-end 表示 hypervisor 端,即在宿主机上设置虚拟机的 QoS,通常使用 cgroup 或者 qemu-iothrottling;back-end 端指在存储设备上设置 QoS,该功能需要存储设备的支持。
Ceph RBD 不支持 QoS,故数据盘的 QoS 需要采用 qemu io throttling 在 front-end 端设置。以 Ceph-RBD 的存储为例,设置数据盘的 QoS 步骤如下:

参数解释

total_bytes_sec: the total allowed bandwidth for the guest per second
read_bytes_sec: sequential read limitation
write_bytes_sec: sequential write limitation
total_iops_sec: the total allowed IOPS for the guest per second
read_iops_sec: random read limitation
write_iops_sec: random write limitation

设置qos

[root@node1 ~]# cinder qos-create ceph-ssd-qos consumer=front-end read_bytes_sec=50000000 write_bytes_sec=50000000 read_iops_sec=400 write_iops_sec=400
+----------+--------------------------------------+
| Property | Value                                |
+----------+--------------------------------------+
| consumer | front-end                            |
| id       | fc315a12-d450-4a47-91fa-57792bb80932 |
| name     | ceph-ssd-qos                         |
| specs    | read_bytes_sec : 50000000            |
|          | read_iops_sec : 400                  |
|          | write_bytes_sec : 50000000           |
|          | write_iops_sec : 400                 |
+----------+--------------------------------------+

创建存储类型

[root@node1 ~]# cinder type-create ceph-storage
+--------------------------------------+--------------+-------------+-----------+
| ID                                   | Name         | Description | Is_Public |
+--------------------------------------+--------------+-------------+-----------+
| 4c9c7c5a-a15c-41ab-98c5-45cdea8c91cd | ceph-storage | -           | True      |
+--------------------------------------+--------------+-------------+-----------+

将存储类型和后端存储绑定

# cinder --os-username admin --os-tenant-name admin type-key ceph-storage set volume_backend_name=ceph

注意:后端存储类型名称查看

[root@node1 ~]# cat /etc/cinder/cinder.conf | grep volume_backend_name | grep -v ^#
volume_backend_name = ceph

查看卷类型

[root@node1 ~]# cinder type-list
+--------------------------------------+--------------+-------------+-----------+
| ID                                   | Name         | Description | Is_Public |
+--------------------------------------+--------------+-------------+-----------+
| 4c9c7c5a-a15c-41ab-98c5-45cdea8c91cd | ceph-storage | -           | True      |
+--------------------------------------+--------------+-------------+-----------+

查看qos

[root@node1 ~]# cinder qos-list
+--------------------------------------+--------------+-----------+----------------------------------------------------------------------------------------------------------------+
| ID                                   | Name         | Consumer  | specs                                                                                                          |
+--------------------------------------+--------------+-----------+----------------------------------------------------------------------------------------------------------------+
| fc315a12-d450-4a47-91fa-57792bb80932 | ceph-ssd-qos | front-end | {'read_bytes_sec': '50000000', 'write_iops_sec': '400', 'write_bytes_sec': '50000000', 'read_iops_sec': '400'} |
+--------------------------------------+--------------+-----------+----------------------------------------------------------------------------------------------------------------+
[root@node1 ~]# 

将卷类型和qos绑定

格式: cinder qos-associate QOS_ID   TYPE_ID

[root@node1 ~]# cinder qos-associate fc315a12-d450-4a47-91fa-57792bb80932  4c9c7c5a-a15c-41ab-98c5-45cdea8c91cd

验证

创建卷并将卷绑定到虚拟机上

[root@node1 ~]# virsh dumpxml 3 | grep sec
        <secret type='ceph' uuid='47fd1361-7286-44b4-863f-1445b8aafe04'/>
        <secret type='ceph' uuid='47fd1361-7286-44b4-863f-1445b8aafe04'/>
        <read_bytes_sec>50000000</read_bytes_sec>
        <write_bytes_sec>50000000</write_bytes_sec>
        <read_iops_sec>400</read_iops_sec>
        <write_iops_sec>400</write_iops_sec>
  <seclabel type='none' model='none'/>
  <seclabel type='dynamic' model='dac' relabel='yes'>
  </seclabel>
[root@node1 ~]# 

参考:
https://docs.openstack.org/cinder/latest/admin/blockstorage-capacity-based-qos.html
这里写图片描述

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值