After completing this section, you should be able to manage block-based storage elements and activities for common application data use cases.
As the domain operator, you might be asked to advise cloud users about managing volumes, snapshots, transfers, and how volume types work. Red Hat OpenStack Platform allows cloud users to create and use block storage devices through volumes and attach them to instances. Volumes can be attached to more than one instance at a time using the multiattach feature with Red Hat Ceph Storage as a block storage back end. Cloud users use the snapshots feature for cloning a volume and restoring it to a previous state.
Cloud users create volumes to attach them to a running instance to give them persistent storage. They can attach and detach the volume at will; the volume can be attached to another instance at any time. To create a volume using the CLI, use the openstack volume create command.
Table 5.2. Table of Volume Arguments
| Argument | Description |
|---|---|
| image | Provides an OS boot image to the instance. |
| snapshot | Used when cloning or restoring an instance to a previous state. |
| source | Used when cloning an instance. |
| size | The volume size in GB. Cannot be used with the snapshot and source options. |
| type | Specifies a set of capabilities of the storage back end. |
The following example demonstrates the use of the openstack volume create command.
[user@demo ~(admin)]$openstack volume create \>--size 10 \>demo-volume1+---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | attachments | [] | | availability_zone | nova | | bootable | false | | consistencygroup_id | None | | created_at | 2020-06-10T21:22:17.000000 | | description | None | | encrypted | False | | id | e8efc7b8-4dfe-4667-be8a-4ac58c1fd8a9 | | migration_status | None | | multiattach | False | | name | demo-volume1 | | properties | | | replication_status | None | | size | 10 | | snapshot_id | None | | source_volid | None | | status | creating | | type | tripleo | | updated_at | None | | user_id | 40da11b61dae43248a0b8f7e42a14128 | +---------------------+--------------------------------------+
A volume can be attached to a running instance. Use the openstack server add volume command to attach a volume to an instance. Users can log in to the instance and mount, format, and use the disk after attaching the volume.
[user@demo ~(admin)]$openstack server add volume \>demo-server1 demo-volume1
A volume can also be detached from an instance with the openstack server remove volume command.
[user@demo ~(admin)]$openstack server remove volume \>demo-server1 demo-volume1
The status of the volume can be viewed with the openstack volume list command. The volume status can be either Available or In-Use. Use the openstack volume list command to view the volumes.
[user@demo ~(admin)]$ openstack volume list -f json
[
{
"ID": "e8efc7b8-4dfe-4667-be8a-4ac58c1fd8a9",
"Name": "demo-volume1",
"Status": "available",
"Size": 10,
"Attached to": []
}
]Use the openstack volume delete command to remove a volume. Separate the volume name or ID with a space to delete more than one volume.
[user@demo ~(admin)]$ openstack volume delete demo-volume1Some use cases require a volume to be shared between users in different projects. To transfer a volume, the volume must be in the available state. This means that the volume must not be attached to any instance at the time the transfer is performed.
When the transfer is performed, either using the CLI or the Dashboard, the user transferring the volume gets both a transfer ID and an authorization key. The transfer ID and the authorization key must be provided to the user receiving the volume transfer in order for the user to be able to accept the transfer. Until the transfer is accepted by the user receiving the volume transfer, the volume is only available to the user creating the transfer. When the transfer is accepted, the volume is no longer available to the user creating the transfer, and it becomes available to the user accepting the volume transfer.
As a domain operator you need to understand the following steps to advise your cloud users how to perform a volume transfer.
The volume's owner needs to create a request with the openstack volume transfer request create command, which creates an ID and an authorization key for the transfer, and must be given to the future volume owner.
[user@demo ~(admin)]$openstack volume transfer request create demo-volume1+------------+--------------------------------------+ | Field | Value | +------------+--------------------------------------+ | auth_key |d3f5cd540e80bfe3| | created_at | 2020-06-10T21:24:42.367483 | | id |8b34c332-a948-4c2a-a3ba-72ed5e8862f1| | name | None | | volume_id | e8efc7b8-4dfe-4667-be8a-4ac58c1fd8a9 | +------------+--------------------------------------+
The volume recipient needs to run the openstack volume transfer request accept command to claim ownership of the volume.
[user@demo ~(admin2)]$openstack volume transfer request accept \>--auth-key d3f5cd540e80bfe3 \>8b34c332-a948-4c2a-a3ba-72ed5e8862f1+-----------+--------------------------------------+ | Field | Value | +-----------+--------------------------------------+ | id | 8b34c332-a948-4c2a-a3ba-72ed5e8862f1 | | name | None | | volume_id | e8efc7b8-4dfe-4667-be8a-4ac58c1fd8a9 | +-----------+--------------------------------------+
Volume backups differ from volume snapshots. Backups are usually stored in a different location and preserve the data in the object storage back end. Snapshots use the same location as volumes and maintain the state of a volume at a certain point in time. Snapshots are also used to clone and create a new volume.
Use the openstack volume snapshot create command to create a snapshot. Use the --force option if the volume is attached to an instance.
[user@demo ~(admin)]$openstack volume snapshot create \>--volume demo-volume1 MySnapshot+-------------+--------------------------------------+ | Field | Value | +-------------+--------------------------------------+ | created_at | 2020-06-10T23:49:36.457518 | | description | None | | id | 697d6394-2ce0-49e8-8180-2624a2303b60 | | name | MySnapshot | | properties | | | size | 10 | | status | creating | | updated_at | None | | volume_id | e8efc7b8-4dfe-4667-be8a-4ac58c1fd8a9 | +-------------+--------------------------------------+
Use the openstack volume snapshot list command to view a list of snapshots.
[user@demo ~(admin)]$ openstack volume snapshot list
[
{
"ID": "697d6394-2ce0-49e8-8180-2624a2303b60",
"Name": "MySnapshot",
"Description": null,
"Status": "available",
"Size": 10
}
]Use the openstack volume snapshot delete command to delete snapshots. To delete more than one snapshot, separate the names with spaces.
[user@demo ~(admin)]$ openstack volume snapshot delete MySnapshotThe domain operator can create different volume types. The volume types help offer different storage back ends and an abstract collection of criteria to characterize volumes, such as gold and silver volume types, as a tiered level of storage. Volume types can be encrypted to add security, and also associated with Quality of Service (QoS) to add features to the storage. RHOSP ships with two volume types: the tripleo volume type is the default storage and points to a Ceph back end; and Red Hat OpenStack Platform Director installs it. The __DEFAULT__ volume type is hard-coded in the product, and it is used when the default_volume_type option is not set in cinder.conf.
Use the openstack volume type create command to create volume types.
[user@demo ~(admin)]$openstack volume type create \>--public --encryption-provider luks vt-encrypted+-------------+------------------------------------------------------------------+ | Field | Value | +-------------+------------------------------------------------------------------+ | description | None | | encryption | cipher=, control_location='front-end', | | | encryption_id='a5bb24a0-e434-4b45-801e-43afed5472bc', key_size=, | | | provider='luks' | | id | 0febf435-c005-4f44-97c4-6353406bc587 | | is_public | True | | name | vt-encrypted | +-------------+------------------------------------------------------------------+
Use the openstack volume qos associate command to associate Quality of Service to a volume type.
[user@demo ~(admin)]$openstack volume qos associate \>qos-limit-iops vt-encrypted
Additional information is available in the Storage Guide for Red Hat OpenStack Platform, at https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/16.0/html-single/storage_guide/
Additional information is available in the Block Storage Backup Guide for Red Hat OpenStack Platform, at https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/16.0/html-single/block_storage_backup_guide/