Merge "Add usage of cinder_img_volume_type property"

This commit is contained in:
Jenkins 2016-04-02 11:05:13 +00:00 committed by Gerrit Code Review
commit 65c8398c91
2 changed files with 142 additions and 0 deletions

View File

@ -120,6 +120,123 @@ This example creates a ``my-new-volume`` volume based on an image.
If your volume was created successfully, its status is ``available``. If
its status is ``error``, you might have exceeded your quota.
.. _Create_a_volume_from_specified_volume_type:
Create a volume from specified volume type
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cinder supports these three ways to specify ``volume type`` during
volume creation.
#. volume_type
#. cinder_img_volume_type (via glance image metadata)
#. default_volume_type (via cinder.conf)
.. _volume_type:
volume_type
-----------
User can specify `volume type` when creating a volume.
.. code-block:: console
$ cinder create --name <volume name> --volume-type <volume type> <size>
.. _cinder_img_volume_type:
cinder_img_volume_type
----------------------
If glance image has ``cinder_img_volume_type`` property, Cinder uses this
parameter to specify ``volume type`` when creating a volume.
Choose glance image which has "cinder_img_volume_type" property and create
a volume from the image.
.. code-block:: console
$ glance image-list
+--------------------------------------+---------------------------------+
| ID | Name |
+--------------------------------------+---------------------------------+
| a8701119-ca8d-4957-846c-9f4d27f251fa | cirros-0.3.4-x86_64-uec |
| 6cf01154-0408-416a-b69c-b28b48c5d28a | cirros-0.3.4-x86_64-uec-kernel |
| de457c7c-2038-435d-abed-5dfa6430e66e | cirros-0.3.4-x86_64-uec-ramdisk |
+--------------------------------------+---------------------------------+
$ glance image-show a8701119-ca8d-4957-846c-9f4d27f251fa
+------------------------+--------------------------------------+
| Property | Value |
+------------------------+--------------------------------------+
| checksum | eb9139e4942121f22bbc2afc0400b2a4 |
| cinder_img_volume_type | lvmdriver-1 |
| container_format | ami |
| created_at | 2016-02-07T19:39:13Z |
| disk_format | ami |
| id | a8701119-ca8d-4957-846c-9f4d27f251fa |
| kernel_id | 6cf01154-0408-416a-b69c-b28b48c5d28a |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros-0.3.4-x86_64-uec |
| owner | 4c0dbc92040c41b1bdb3827653682952 |
| protected | False |
| ramdisk_id | de457c7c-2038-435d-abed-5dfa6430e66e |
| size | 25165824 |
| status | active |
| tags | [] |
| updated_at | 2016-02-22T23:01:54Z |
| virtual_size | None |
| visibility | public |
+------------------------+--------------------------------------+
$ cinder create --name test --image-id a8701119-ca8d-4957-846c-9f4d27f251fa 1
+---------------------------------------+--------------------------------------+
| Property | Value |
+---------------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2016-02-22T23:17:51.000000 |
| description | None |
| encrypted | False |
| id | 123ad92f-8f4c-4639-ab10-3742a1d9b47c |
| metadata | {} |
| migration_status | None |
| multiattach | False |
| name | test |
| os-vol-host-attr:host | None |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| os-vol-tenant-attr:tenant_id | 4c0dbc92040c41b1bdb3827653682952 |
| os-volume-replication:driver_data | None |
| os-volume-replication:extended_status | None |
| replication_status | disabled |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| updated_at | None |
| user_id | 9a125f3d111e47e6a25f573853b32fd9 |
| volume_type | lvmdriver-1 |
+---------------------------------------+--------------------------------------+
.. _default_volume_type:
default_volume_type
-------------------
If above parameters are not set, Cinder uses default_volume_type which is
defined in cinder.conf during volume creation.
Example cinder.conf file configuration.
.. code-block:: console
[default]
default_volume_type = lvmdriver-1
.. _Attach_a_volume_to_an_instance:
Attach a volume to an instance

View File

@ -156,6 +156,31 @@ the volume to boot an instance.
Note the ID of the image that you want to use to create a volume.
If you want to create a volume to a specific storage backend, you need
to use an image which has *cinder_img_volume_type* property.
In this case, a new volume will be created as *storage_backend1* volume
type.
.. code-block:: console
$ nova image-show 98901246-af9...
+---------------------------------+--------------------------------------+
| Property | Value |
+---------------------------------+--------------------------------------+
| OS-EXT-IMG-SIZE:size | 25165824 |
| created | 2016-03-11T16:39:25Z |
| id | 98901246-af9... |
| metadata cinder_img_volume_type | storage_backend1 |
| metadata kernel_id | 759e3e20-83b... |
| metadata ramdisk_id | 5a8b526f-d5c... |
| minDisk | 0 |
| minRam | 0 |
| name | cirros-0.3.4-x86_64-uec |
| progress | 100 |
| status | ACTIVE |
| updated | 2016-03-17T22:55:03Z |
+---------------------------------+--------------------------------------+
#. List the available flavors.
.. code-block:: console