zoukankan      html  css  js  c++  java
  • [Cinder] 存储 Qos

    目录

    前言

    Cinder 支持 front-endback-end 两种类型的存储 QoS,前者由 Hypervisor 端实现(e.g. 通过 Libvirt 设置虚拟机的存储 QoS),后者指存储设备上设置的 QoS,需要存储设备支持。 一般的物理存储设备都会支持 QoS,但 SDS 的 Ceph RBD 不支持,所以使用 Ceph 存储方案的用户一般只能使用 front-end Qos 来限制虚拟机对数据盘的 Qos。

    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

    操作步骤

    通过 openstackclient 创建具有 QoS Policy 的 Volume Type

    [stack@manager ~]$ openstack volume type create VolumeType1
    +---------------------------------+--------------------------------------+
    | Field                           | Value                                |
    +---------------------------------+--------------------------------------+
    | description                     | None                                 |
    | id                              | ae5359b3-0bbc-4104-88ca-3749eab07cc8 |
    | is_public                       | True                                 |
    | name                            | VolumeType1                          |
    | os-volume-type-access:is_public | True                                 |
    +---------------------------------+--------------------------------------+
    
    [stack@manager ~]$ openstack volume type show VolumeType1
    +---------------------------------+--------------------------------------+
    | Field                           | Value                                |
    +---------------------------------+--------------------------------------+
    | access_project_ids              | None                                 |
    | description                     | None                                 |
    | id                              | ae5359b3-0bbc-4104-88ca-3749eab07cc8 |
    | is_public                       | True                                 |
    | name                            | VolumeType1                          |
    | os-volume-type-access:is_public | True                                 |
    | properties                      |                                      |
    | qos_specs_id                    | None                                 |
    +---------------------------------+--------------------------------------+
    
    [stack@manager ~]$ openstack volume qos create qos1 --consumer front-end --property total_iops_sec=200
    +----------+--------------------------------------+
    | Field    | Value                                |
    +----------+--------------------------------------+
    | consumer | front-end                            |
    | id       | 05ab9096-3a0f-45d8-acb8-f0cac172ae8c |
    | name     | qos1                                 |
    | specs    | {u'total_iops_sec': u'200'}          |
    +----------+--------------------------------------+
    
    [stack@manager ~]$ openstack volume qos set --property total_bytes_sec=2048000 qos1
    
    [stack@manager ~]$ openstack volume qos associate qos1 VolumeType1
    

    指定 VolumeType 创建 Volume:

    [stack@manager ~]$ openstack volume create --type VolumeType1 --size 1 volume1
    +---------------------+--------------------------------------+
    | Field               | Value                                |
    +---------------------+--------------------------------------+
    | attachments         | []                                   |
    | availability_zone   | nova                                 |
    | bootable            | false                                |
    | consistencygroup_id | None                                 |
    | created_at          | 2018-12-26T13:51:22.597699           |
    | description         | None                                 |
    | encrypted           | False                                |
    | id                  | c24e2a9e-1792-4951-a040-434b87409558 |
    | migration_status    | None                                 |
    | multiattach         | False                                |
    | name                | volume1                              |
    | properties          |                                      |
    | replication_status  | disabled                             |
    | size                | 1                                    |
    | snapshot_id         | None                                 |
    | source_volid        | None                                 |
    | status              | creating                             |
    | type                | VolumeType1                          |
    | updated_at          | None                                 |
    | user_id             | 11b816e454384d038472c7c89d2544f4     |
    +---------------------+--------------------------------------+
    
    [stack@manager ~]$ openstack volume list
    +--------------------------------------+--------------+-----------+------+-------------+
    | ID                                   | Display Name | Status    | Size | Attached to |
    +--------------------------------------+--------------+-----------+------+-------------+
    | c24e2a9e-1792-4951-a040-434b87409558 | volume1      | available |    1 |             |
    +--------------------------------------+--------------+-----------+------+-------------+
    

    查看 Libvirt 虚拟机的 XML 文件内容,disk 标签具有 QoS 属性 <iotune>

    [root@overcloud-compute-0 ~]#  virsh dumpxml 1
    ...
    <disk type='block' device='disk'>
          <driver name='qemu' type='raw' cache='none' io='native'/>
          <source dev='/dev/sdd'/>
          <backingStore/>
          <target dev='vdb' bus='virtio'/>
          <iotune>
            <total_iops_sec>200</total_iops_sec>
            <total_bytes_sec>2048000</total_bytes_sec>
          </iotune>
          <serial>c24e2a9e-1792-4951-a040-434b87409558</serial>
          <alias name='virtio-disk1'/>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
        </disk>
    

    通过 virsh 设定 Libvirt 虚拟机的 QoS 属性

    [root@overcloud-compute-0 ~]# virsh blkdeviotune 1 vdb --total_iops_sec 100
    
    [root@overcloud-compute-0 ~]# virsh blkdeviotune 1 vdb --total-bytes-sec 1024000
    
    [root@overcloud-compute-0 ~]# virsh dumpxml 1
    ...
        <disk type='block' device='disk'>
          <driver name='qemu' type='raw' cache='none' io='native'/>
          <source dev='/dev/sdd'/>
          <backingStore/>
          <target dev='vdb' bus='virtio'/>
          <iotune>
            <total_bytes_sec>1024000</total_bytes_sec>
            <total_iops_sec>100</total_iops_sec>
          </iotune>
          <serial>c24e2a9e-1792-4951-a040-434b87409558</serial>
          <alias name='virtio-disk1'/>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
        </disk>
    

    NOTE:Qos 一般来说都是在一个建议值上下浮动的,所以可以通过指定 --total-iops-sec-max 来固定上限。

    参考文章

    Capacity based quality of service
    https://blog.csdn.net/LL_JCB/article/details/80412362

  • 相关阅读:
    emWin 界面切换注意事项
    emWin 工程之汉字显示
    emWin 使用 GUIBuilder 放置标题 TEXT 注意
    【转】系统调用和驱动程序中相应函数的参数对应关系
    主机 & 虚拟机 & 开发板 相互通信
    电脑通过网口连接开发板
    【转】ARM交叉编译工具链
    【转】vi 写完文件保存时才发现是 readonly
    【转】ubuntu 12.04下如何开启 NFS 服务 & 设置
    安装完打开 eclipse 提示 JVM 版本较低
  • 原文地址:https://www.cnblogs.com/jmilkfan-fanguiju/p/10589736.html
Copyright © 2011-2022 走看看