Chapter 3. Performing basic operations with the Block Storage service (cinder) Create and configure Block Storage volumes as the primary form of persistent storage for Compute instances in your overcloud. Create volumes, attach your volumes to instances, edit and resize your volumes, and modify volume ownership. 3.1. Creating Block Storage volumes Create volumes to provide persistent storage for instances that you launch with the Compute service (nova) in the overcloud. Important The default maximum number of volumes you can create for a project is 10. Prerequisites A successful undercloud installation. For more information, see Installing director on the undercloud . A successful overcloud deployment. For more information, see Creating a basic overcloud with CLI tools . Access to the Red Hat OpenStack Platform (RHOSP) Dashboard (horizon). For more information, see Overcloud deployment output . Procedure In the dashboard, select Project > Compute > Volumes . Click Create Volume , and edit the following fields: Field Description Volume name Name of the volume. Description Optional, short description of the volume. Type Optional volume type (see Section 2.3, "Group volume configuration with volume types" ). If you have multiple Block Storage back ends, you can use this to select a specific back end. See Section 2.10, "Specifying back ends for volume creation" . Size (GB) Volume size (in gigabytes). If you want to create an encrypted volume from an unencrypted image, you must ensure that the volume size is larger than the image size so that the encryption data does not truncate the volume data. Availability Zone Availability zones (logical server groups), along with host aggregates, are a common method for segregating resources within OpenStack. Availability zones are defined during installation. For more information about availability zones and host aggregates, see Creating and managing host aggregates in the Configuring the Compute Service for Instance Creation guide. Specify a Volume Source : Source Description No source, empty volume The volume is empty and does not contain a file system or partition table. Snapshot Use an existing snapshot as a volume source. If you select this option, a new Use snapshot as a source list opens; you can then choose a snapshot from the list. If you want to create a new volume from a snapshot of an encrypted volume, you must ensure that the new volume is at least 1GB larger than the old volume. For more information about volume snapshots, see Section 4.1, "Creating, using, and deleting volume snapshots" . Image Use an existing image as a volume source. If you select this option, a new Use snapshot as a source list opens; you can then choose an image from the list. Volume Use an existing volume as a volume source. If you select this option, a new Use snapshot as a source list opens; you can then choose a volume from the list. Click Create Volume . After the volume is created, its name appears in the Volumes table. You can also change the volume type later on. For more information, see Section 4.5, "Block Storage volume retyping" . 3.2. Editing a volume name or description Edit volume names and descriptions in the Dashboard (horizon). Prerequisites A successful undercloud installation. For more information, see Installing director on the undercloud . A successful overcloud deployment. For more information, see Creating a basic overcloud with CLI tools . Access to the Red Hat OpenStack Platform (RHOSP) Dashboard (horizon). For more information, see Overcloud deployment output . Procedure In the dashboard, select Project > Compute > Volumes . Select the volume's Edit Volume button. Edit the volume name or description as required. Click Edit Volume to save your changes. Note To create an encrypted volume, you must first have a volume type configured specifically for volume encryption. In addition, you must configure both Compute and Block Storage services to use the same static key. For information about how to set up the requirements for volume encryption, see Section 2.7, "Block Storage service (cinder) volume encryption" . 3.3. Resizing (extending) a Block Storage service volume Resize volumes to increase the storage capacity of the volumes. Note The ability to resize a volume in use is supported but is driver dependent. RBD is supported. You cannot extend in-use multi-attach volumes. For more information about support for this feature, contact Red Hat Support. Prerequisites A successful undercloud installation. For more information, see Installing director on the undercloud . Procedure List the volumes to retrieve the ID of the volume you want to extend: To resize the volume, run the following commands to specify the correct API microversion, then pass the volume ID and the new size (a value greater than the old one) as parameters: Replace <API microversion>, <volume ID>, and <size> with appropriate values. Use the following example as a guide: 3.4. Deleting a Block Storage service volume Use the Dashboard to delete volumes that you no longer require. Note A volume cannot be deleted if it has existing snapshots. For instructions on how to delete snapshots, see Section 4.1, "Creating, using, and deleting volume snapshots" . Prerequisites A successful undercloud installation. For more information, see Installing director on the undercloud . A successful overcloud deployment. For more information, see Creating a basic overcloud with CLI tools . Access to the Red Hat OpenStack Platform (RHOSP) Dashboard (horizon). For more information, see Overcloud deployment output . Procedure In the dashboard, select Project > Compute > Volumes . In the Volumes table, select the volume to delete. Click Delete Volumes . 3.5. Allocating volumes to multiple back ends If the Block Storage service is configured to use multiple back ends, you can use configured volume types to specify where a volume should be created. For more information, see Section 2.10, "Specifying back ends for volume creation" . The Block Storage service will automatically choose a back end if you do not specify one during volume creation. Block Storage sets the first defined back end as a default; this back end will be used until it runs out of space. At that point, Block Storage will set the second defined back end as a default, and so on. If this is not suitable for your needs, you can use the filter scheduler to control how Block Storage should select back ends. This scheduler can use different filters to triage suitable back ends, such as: AvailabilityZoneFilter Filters out all back ends that do not meet the availability zone requirements of the requested volume. CapacityFilter Selects only back ends with enough space to accommodate the volume. CapabilitiesFilter Selects only back ends that can support any specified settings in the volume. InstanceLocality Configures clusters to use volumes local to the same node. Prerequisites A successful undercloud installation. For more information, see the Director Installation and Usage guide. Procedure Add an environment file to your deployment command that contains the following parameters: 1 You can also add the ControllerExtraConfig: hook and its nested sections to the parameter_defaults: section of an existing environment file. 3.6. Attaching a volume to an instance Instances can use a volume for persistent storage. A volume can only be attached to one instance at a time. For more information about instances, see Image service in the Creating and Managing Images guide. Prerequisites A successful undercloud installation. For more information, see Installing director on the undercloud . A successful overcloud deployment. For more information, see Creating a basic overcloud with CLI tools . Access to the Red Hat OpenStack Platform (RHOSP) Dashboard (horizon). For more information, see Overcloud deployment output . Procedure In the dashboard, select Project > Compute > Volumes . Select the Edit Attachments action. If the volume is not attached to an instance, the Attach To Instance drop-down list is visible. From the Attach To Instance list, select the instance to which you want to attach the volume. Click Attach Volume . 3.7. Detaching a volume from an instance Instances can use a volume for persistent storage. A volume can only be attached to one instance at a time. For more information about instances, see Image service in the Creating and Managing Images guide. Prerequisites A successful undercloud installation. For more information, see Installing director on the undercloud . A successful overcloud deployment. For more information, see Creating a basic overcloud with CLI tools . Access to the Red Hat OpenStack Platform (RHOSP) Dashboard (horizon). For more information, see Overcloud deployment output . Procedure In the dashboard, select Project > Compute > Volumes . Select the volume's Manage Attachments action. If the volume is attached to an instance, the instance's name is displayed in the Attachments table. Click Detach Volume in this and the dialog screen. 3.8. Configuring the access rights to a volume The default state of a volume is read-write to allow data to be written to and read from it. You can mark a volume as read-only to protect its data from being accidentally overwritten or deleted. Note After changing a volume to be read-only you can change it back to read-write again. Prerequisites A successful undercloud installation. For more information, see Installing director on the undercloud . A successful overcloud deployment. For more information, see Creating a basic overcloud with CLI tools . Procedure If the volume is already attached to an instance, then detach this volume. For more information, see Section 3.7, "Detaching a volume from an instance" . Set the required access rights for this volume: To set the access rights of a volume to read-only: To set the access rights of a volume to read-write: If you detached this volume from an instance to change the access rights, then re-attach the volume. For more information, see Section 3.6, "Attaching a volume to an instance" . 3.9. Changing a volume owner with the CLI To change a volume's owner, you will have to perform a volume transfer. A volume transfer is initiated by the volume's owner, and the volume's change in ownership is complete after the transfer is accepted by the volume's new owner. Prerequisites A successful undercloud installation. For more information, see Installing director on the undercloud . A successful overcloud deployment. For more information, see Creating a basic overcloud with CLI tools . Procedure Log in as the volume's current owner. List the available volumes: Initiate the volume transfer: Where VOLUME is the name or ID of the volume you wish to transfer. For example, The cinder transfer-create command clears the ownership of the volume and creates an id and auth_key for the transfer. These values can be given to, and used by, another user to accept the transfer and become the new owner of the volume. The new user can now claim ownership of the volume. To do so, the user should first log in from the command line and run: Where TRANSFERID and TRANSFERKEY are the id and auth_key values returned by the cinder transfer-create command, respectively. For example, Note You can view all available volume transfers using: 3.10. Changing a volume owner with the Dashboard To change a volume's owner, you will have to perform a volume transfer. A volume transfer is initiated by the volume's owner, and the volume's change in ownership is complete after the transfer is accepted by the volume's new owner. Prerequisites A successful undercloud installation. For more information, see Installing director on the undercloud . A successful overcloud deployment. For more information, see Creating a basic overcloud with CLI tools . Access to the Red Hat OpenStack Platform (RHOSP) Dashboard (horizon). For more information, see Overcloud deployment output . Procedure As the volume owner in the dashboard, select Projects > Volumes . In the Actions column of the volume to transfer, select Create Transfer . In the Create Transfer dialog box, enter a name for the transfer and click Create Volume Transfer . The volume transfer is created, and in the Volume Transfer screen you can capture the transfer ID and the authorization key to send to the recipient project. Click the Download transfer credentials button to download a .txt file containing the transfer name , transfer ID , and authorization key . Note The authorization key is available only in the Volume Transfer screen. If you lose the authorization key, you must cancel the transfer and create another transfer to generate a new authorization key. Close the Volume Transfer screen to return to the volume list. The volume status changes to awaiting-transfer until the recipient project accepts the transfer Accept a volume transfer from the dashboard As the recipient project owner in the dashboard, select Projects > Volumes . Click Accept Transfer . In the Accept Volume Transfer dialog box, enter the transfer ID and the authorization key that you received from the volume owner and click Accept Volume Transfer . The volume now appears in the volume list for the active project.

Commands:
cinder list
OS_VOLUME_API_VERSION=<API microversion> cinder extend <volume ID> <size>
OS_VOLUME_API_VERSION=3.42 cinder extend 573e024d-5235-49ce-8332-be1576d323f8 10
parameter_defaults: ControllerExtraConfig: # 1 cinder::config::cinder_config: DEFAULT/scheduler_default_filters: value: 'AvailabilityZoneFilter,CapacityFilter,CapabilitiesFilter,InstanceLocality'
cinder readonly-mode-update <VOLUME-ID> true
cinder readonly-mode-update <VOLUME-ID> false
cinder list
cinder transfer-create VOLUME
+------------+--------------------------------------+ | Property | Value | +------------+--------------------------------------+ | auth_key | f03bf51ce7ead189 | | created_at | 2014-12-08T03:46:31.884066 | | id | 3f5dc551-c675-4205-a13a-d30f88527490 | | name | None | | volume_id | bcf7d015-4843-464c-880d-7376851ca728 | +------------+--------------------------------------+
cinder transfer-accept TRANSFERID TRANSFERKEY
cinder transfer-accept 3f5dc551-c675-4205-a13a-d30f88527490 f03bf51ce7ead189
cinder transfer-list