When existing volumes are managed, they do not have storage templates (volume types) associated with them. This can cause problems. For example, consistency groups require a storage template. Starting with PowerVC 1.4.1, the administrator can set the storage template ID for a volume.

In this blog we will show you how to use the set-template and onboard-voltype commands to set the storage template after managing existing volumes.

Command:

powervc-config storage set-template 

usage: powervc-config storage set-template [-h] -v Volume_ID
                                           [-t Storage_Template_ID] [-q]

optional arguments:
-h, –help
Show this help message and exit.

-v Volume_ID, –volume Volume_ID
The volume ID of the volume to set the storage template on. If you don’t know the volume ID, run the 'cinder list' command or look at the volume in the user interface.

-t Storage_Template_ID, –storage-template Storage_Template_ID
The ID of the storage template to associate with the volume. It is important that you
ensure that the storage template is appropriate for the volume. For a list of
template IDs, run the 'cinder type-list' command.

If this option is not specified, the current storage template associated with the
volume is displayed.

-q, –quiet
Quiet mode. The user is not prompted for input.

Example

1. Add a volume and ensure the volume has no storage template set:

Test #cinder list
+--------------------------------------+-----------+-------------------------+------+-------------+----------+-------------+
| ID                                   | Status    | Name                    | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+-------------------------+------+-------------+----------+-------------+
| 9a40f1b8-9b16-4148-8f1e-c39e7a989659 | available | DND_RHEL_75_LE_BETA_JAs | 11   | -           | false    |             |
+--------------------------------------+-----------+-------------------------+------+-------------+----------+-------------+
Test #
Test #powervc-config storage set-template -v 9a40f1b8-9b16-4148-8f1e-c39e7a989659
Volume: '9a40f1b8-9b16-4148-8f1e-c39e7a989659' is associated with storage template: 'None'
Test #

In GUI it looks like the below-

2. Find an appropriate storage template and note the ID:

Test #cinder type-list
+--------------------------------------+-----------------------------+-------------+-----------+
| ID                                   | Name                        | Description | Is_Public |
+--------------------------------------+-----------------------------+-------------+-----------+
| 22ebcab1-e6dd-4337-808c-2e4105773033 | Storwize_test base template | -           | True      |
+--------------------------------------+-----------------------------+-------------+-----------+
Test #

3. Set the storage template:

Test #powervc-config storage set-template -v 9a40f1b8-9b16-4148-8f1e-c39e7a989659 -t 22ebcab1-e6dd-4337-808c-2e4105773033
   Warning: By setting the storage template on a volume the storage template may not match the properties of the volume on storage provider. Do you want to continue [y/n]? y
Volume's storage template successfully updated.
Test #

If you don’t want to be prompted for input, use quiet mode:

Test #powervc-config storage set-template -v 9a40f1b8-9b16-4148-8f1e-c39e7a989659 -t 22ebcab1-e6dd-4337-808c-2e4105773033 -q
Volume's storage template successfully updated.
Test #

4. Verify that the storage template was successfully updated:

Test #powervc-config storage set-template -v 9a40f1b8-9b16-4148-8f1e-c39e7a989659
Volume: '9a40f1b8-9b16-4148-8f1e-c39e7a989659' is associated with storage template: 'Storwize_test base template'
Test #

You can also see it in the user interface:

Setting the default storage template when managing existing volumes

You can set the preferred storage template to use when managing existing volumes for a specific storage host by running the onboard-voltype command. Use this with caution because setting a storage template that does not match the volume properties would cause issues.

powervc-config storage onboard-voltype

usage: powervc-config storage onboard-voltype [-h] --storageHost Storage_Host
                                              [--volumeType Volume_Type_ID]
                                              [--disable] [--restart]

optional arguments:
-h, –help Show this help message and exit.
–storageHost Storage_Host
Storage provider to set the default storage template for. To determine the possible storage providers, run the 'powervc-register -o list -r storage' command and look at
the ‘Name’ column.

–volumeType Volume_Type_ID
The ID of the default storage template to use for existing volumes that are brought under
PowerVC management. This is also called the volume type ID. If not specified, the current
setting is displayed.

–disable
Specifying this flag disables the storage template setting for volumes
brought under management. After setting this flag, any volumes that are brought under
management on this storage host will have no storage template, but you can add a storage template later. If you specify –disable and –volumeType at the same time, any value that
you specify for –volumeType is ignored. This is the default setting.

–restart
Restart the Cinder volume driver. If this option is not specified, a manual restart of the
service will be necessary to make the changes take effect.

Example
1. Find the name of the storage provider

Test #powervc-register -o list -r storage
Name                     Display Name             Type
====                     ============             ====
c387f15u41_v7000         Storwize_test            svc
 Test #

2. Determine if there’s already a storage template associated with the storage provider:

Test #powervc-config storage onboard-voltype --storageHost c387f15u41_v7000
Printing the current setting for onboard_volume_type:
    onboard_volume_type = None  
Test #

3. Find a storage template (volume type) to use:

Test #cinder type-list
+--------------------------------------+-----------------------------+-------------+-----------+
| ID                                   | Name                        | Description | Is_Public |
+--------------------------------------+-----------------------------+-------------+-----------+
| 22ebcab1-e6dd-4337-808c-2e4105773033 | Storwize_test base template | -           | True      |
+--------------------------------------+-----------------------------+-------------+-----------+
Test #

4. Set the storage template as the default template to use for volumes brought under PowerVC management for this storage provider:

Test #powervc-config storage onboard-voltype --storageHost c387f15u41_v7000 --volumeType 22ebcab1-e6dd-4337-808c-2e4105773033 --restart
Warning: No validation of the storage template properties will be done. The storage template may not match the properties of the volume on the storage provider. Do you want to continue [y/n]? y
The onboard_volume_type configuration option has been set.
Restart of cinder services requested.
Test # 

5. Verify that the default storage template has been set. You can check by running the CLI command or by looking at the volume in the user interface.

Test #powervc-config storage onboard-voltype --storageHost c387f15u41_v7000
Printing the current setting for onboard_volume_type:
    onboard_volume_type = 22ebcab1-e6dd-4337-808c-2e4105773033  
Test #

6. If you want to remove the default storage template, run the following command:

Test #powervc-config storage onboard-voltype --storageHost c387f15u41_v7000 --disable --restart
The onboard_volume_type configuration option has been unset.
Restart of cinder services requested.
Test #powervc-config storage onboard-voltype --storageHost c387f15u41_v7000
Printing the current setting for onboard_volume_type:
    onboard_volume_type = None  
Test # 

As you can see, PowerVC makes it easy to work with storage templates for volumes that are brought under management. And be sure to follow us on LinkedIn, Twitter, and Facebook so you don’t miss any updates!

Join The Discussion

Your email address will not be published. Required fields are marked *