欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

OpenStack实践之路——修改云硬盘和云主机的qos

程序员文章站 2022-03-03 07:59:47
...

需要了解的命令

(my_new_env) [email protected]ova10:~$ nova |grep qos
    update-instance-qos  # 代表修改实例(云主机)的qos
    update-qos          Update Qos metadata on a volume.

操作文档

(my_new_env) [email protected]:~$ nova help update-instance-qos
usage: nova update-instance-qos <server> <key=value> [<key=value> ...]

Update Qos metadata on an instance.

Positional arguments:
  <server>     Name or ID of server.
  <key=value>  Qos Metadata to set, key must be from read_iops, write_iops,
               read_bps, write_bps
(my_new_env) [email protected]:~$ nova help update-qos
usage: nova update-qos <server> <volume> <key=value> [<key=value> ...]

Update Qos metadata on a volume.

Positional arguments:
  <server>     Name or ID of server.
  <volume>     ID of the volume to update qos on.
  <key=value>  Qos Metadata to set, key must be from maxReadBandWidth,
               maxWriteBandWidth, maxReadIOPS, maxWriteIOPS,
               maxTotalBandWidth, maxTotalIOPS

查看云硬盘的挂载情况

(my_new_env) [email protected]:~$ nova volume-list 
+--------------------------------------+-----------+---------------------------+------+-------------+--------------------------------------+
| ID                                   | Status    | Display Name              | Size | Volume Type | Attached to                          |
+--------------------------------------+-----------+---------------------------+------+-------------+--------------------------------------+
| c2a0f8dc-a1a4-4912-a0a4-990b3916e5a7 | in-use    | volume-test               | 100  | ceph_sas    | 72aefa0b-f199-4ddb-b721-9e94f233ced8 |

查看云硬盘的qos:nova volume-show <volume-id>

(my_new_env) [email protected]:~$ nova volume-show c2a0f8dc-a1a4-4912-a0a4-990b3916e5a7
+---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Property                                    | Value                                                                                                                                                                                               |
+---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| attachments                                 | [{"device": "/dev/sdb", "server_id": "72aefa0b-f199-4ddb-b721-9e94f233ced8", "volume_id": "c2a0f8dc-a1a4-4912-a0a4-990b3916e5a7", "host_name": null, "id": "c2a0f8dc-a1a4-4912-a0a4-990b3916e5a7"}] |
| availability_zone                           | yiqiao1                                                                                                                                                                                             |
| bootable                                    | false                                                                                                                                                                                               |
| created_at                                  | 2019-06-15T08:08:09.000000                                                                                                                                                                          |
| display_description                         | -                                                                                                                                                                                                   |
| display_name                                | volume-test                                                                                                                                                                                         |
| id                                          | c2a0f8dc-a1a4-4912-a0a4-990b3916e5a7                                                                                                                                                                |
| metadata                                    | {"readonly": "False", "attached_mode": "rw"}                                                                                                                                                        |
| os-vol-host-attr:host                       | [email protected]                                                                                                                                                                     |
| os-vol-provider-attr:provider_location      | rbd://78dad33c-2af2-11e7-bf90-f3aa59af6504/switch02_sas_volumes                                                                                                                                     |
| os-vol-provider-attr:provider_pool_location | -                                                                                                                                                                                                   |
| size                                        | 100                                                                                                                                                                                                 |
| snapshot_id                                 | -                                                                                                                                                                                                   |
| source_volid                                | -                                                                                                                                                                                                   |
| status                                      | in-use                                                                                                                                                                                              |
| volume_qos                                  | {"read_bps": "86558041", "write_bps": "86558041", "read_iops": "122", "write_iops": "204"}                                                                                                          |
| volume_type                                 | ceph_sas                                                                                                                                                                                            |
+---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

将volume-qos设置为不限制:nova update-qos <server-id>  <volume-id>

(my_new_env) [email protected]:~$ nova update-qos 72aefa0b-f199-4ddb-b721-9e94f233ced8 c2a0f8dc-a1a4-4912-a0a4-990b3916e5a7  maxReadBandWidth=0 maxWriteBandWidth=0  maxReadIOPS=0  maxWriteIOPS=0
(my_new_env) [email protected]:~$ nova volume-show c2a0f8dc-a1a4-4912-a0a4-990b3916e5a7
+---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Property                                    | Value                                                                                                                                                                                               |
+---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| attachments                                 | [{"device": "/dev/sdb", "server_id": "72aefa0b-f199-4ddb-b721-9e94f233ced8", "volume_id": "c2a0f8dc-a1a4-4912-a0a4-990b3916e5a7", "host_name": null, "id": "c2a0f8dc-a1a4-4912-a0a4-990b3916e5a7"}] |
| availability_zone                           | yiqiao1                                                                                                                                                                                             |
| bootable                                    | false                                                                                                                                                                                               |
| created_at                                  | 2019-06-15T08:08:09.000000                                                                                                                                                                          |
| display_description                         | -                                                                                                                                                                                                   |
| display_name                                | volume-test                                                                                                                                                                                         |
| id                                          | c2a0f8dc-a1a4-4912-a0a4-990b3916e5a7                                                                                                                                                                |
| metadata                                    | {"readonly": "False", "attached_mode": "rw"}                                                                                                                                                        |
| os-vol-host-attr:host                       | [email protected]                                                                                                                                                                     |
| os-vol-provider-attr:provider_location      | rbd://78dad33c-2af2-11e7-bf90-f3aa59af6504/switch02_sas_volumes                                                                                                                                     |
| os-vol-provider-attr:provider_pool_location | -                                                                                                                                                                                                   |
| size                                        | 100                                                                                                                                                                                                 |
| snapshot_id                                 | -                                                                                                                                                                                                   |
| source_volid                                | -                                                                                                                                                                                                   |
| status                                      | in-use                                                                                                                                                                                              |
| volume_qos                                  | {"total_iops": "0", "total_bps": "0"}                                                                                                                                                               |
| volume_type                                 | ceph_sas                                                                                                                                                                                            |
+---------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

| volume_qos                                  | {"total_iops": "0", "total_bps": "0"}表示qos已经设置为不限制

 

修改云主机的qos与云硬盘的qos非常相似,通过一下命令即可完成:

修改云主机的qos
 nova update-instance-qos 3f0bab10-0ad9-4e88-b937-f316dd7cbe4a read_iops=0 write_iops=0 read_bps=0 write_bps=0