Is it possible to set resource limitation on disk(cinder volume)?

Solution Unverified - Updated

Environment

  • Red Hat Open Stack
  • Cinder

Issue

  • set resource limitation on disk(cinder volume)?

Resolution

  • cinder qos* commands for the same. Go through following example for more details:
# cinder qos-create low-iops consumer="front-end" read_iops_sec=10 write_iops_sec=10
+----------+-----------------------------------------------------+
| Property |                        Value                        |
+----------+-----------------------------------------------------+
| consumer |                      front-end                      |
|    id    |         79bc1bc6-555d-4c1b-9042-7051a50943be        |
|   name   |                       low-iops                      |
|  specs   | {u'write_iops_sec': u'10', u'read_iops_sec': u'10'} |
+----------+-----------------------------------------------------+

# cinder type-create low-iops
+--------------------------------------+----------+
|                  ID                  |   Name   |
+--------------------------------------+----------+
| 47e46918-d2d2-4624-bb16-77bba59199f9 | low-iops |
+--------------------------------------+----------+

# cinder qos-associate 79bc1bc6-555d-4c1b-9042-7051a50943be 47e46918-d2d2-4624-bb16-77bba59199f9

# cinder create --display-name slow --volume-type  low-iops 2
+---------------------+--------------------------------------+
|       Property      |                Value                 |
+---------------------+--------------------------------------+
|     attachments     |                  []                  |
|  availability_zone  |                 nova                 |
|       bootable      |                false                 |
|      created_at     |      2014-05-01T14:44:17.895541      |
| display_description |                 None                 |
|     display_name    |                 slow                 |
|          id         | af148419-4de5-428b-816c-e17dc33e765e |
|       metadata      |                  {}                  |
|         size        |                  2                   |
|     snapshot_id     |                 None                 |
|     source_volid    |                 None                 |
|        status       |               creating               |
|     volume_type     |               low-iops               |
+---------------------+--------------------------------------+

# nova volume-attach  e4ab6634-f0dd-4d2d-a12c-f20db23bf478 af148419-4de5-428b-816c-e17dc33e765e /dev/vdh
+----------+--------------------------------------+
| Property | Value                                |
+----------+--------------------------------------+
| device   | /dev/vdh                             |
| serverId | e4ab6634-f0dd-4d2d-a12c-f20db23bf478 |
| id       | af148419-4de5-428b-816c-e17dc33e765e |
| volumeId | af148419-4de5-428b-816c-e17dc33e765e |
+----------+--------------------------------------+

- Now from instance, try dd some content on /dev/vdh and monitor the speed:
---
# time dd if=/dev/zero of=/mnt/test.out bs=1M count=500 oflag=direct
---

For ex:
[root@test test]# mount |grep -i ext
/dev/vdc on /root/test type ext4 (rw,relatime,seclabel,data=ordered) <== with qos(slow)
/dev/vdd on /mnt type ext4 (rw,relatime,seclabel,data=ordered)   <== without qos(normal)


[root@test test]# dd if=/dev/zero of=/mnt/test.txt  bs=1M count=15  oflag=direct
15+0 records in
15+0 records out
15728640 bytes (16 MB) copied, 0.282361 s, 55.7 MB/s  <====


[root@test test]# dd if=/dev/zero of=/root/test/test.txt  bs=1M count=15  oflag=direct
15+0 records in
15+0 records out
15728640 bytes (16 MB) copied, 4.33381 s, 3.6 MB/s  <==== 
  • QoS options:
 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
SBR
Components
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.