As an administrator, you might want a quick way to identify which volumes were created for PowerVC. With PowerVC 1.4.1 or later, you can do this by specifying a custom volume naming template for PowerVC to use when creating volumes. The template is used by Storwize, XIV, and Hitachi storage providers to generate the name of the volume on the back end storage. Dell EMC VMAX3, VNX, and IBM DS8000 storage providers use their own naming format which cannot be customized using this feature.

In this blog, we will show you how to view the current name template and create a custom volume name template.

View the current volume name template

To view the current template, run powervc-config storage vol-name-format with no other options. If you have not created any templates, the default template volume-%(display_name).37s-%(id).13s is displayed.

You can review the storage provider volume name on the Storage > Volume page of the user interface:

Customize the volume name template

Run the powervc-config storage vol-name-format command to create the volume name template. As described previously, some storage providers can look up the back end volume by using this name.

powervc-config storage vol-name-format -h
usage: powervc-config storage vol-name-format [-h] [--template  Template]
                                              [--storageHost Storage_Host]
                                              [--restart]

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

–template Template
The template to use for the volume name. The display name (display_name) or volume ID (id) can be used for the volume name. For example, --template volume-%(display_name).37s-%(id).13s creates the volume name by using up to 37 characters of the display name and up to 13 characters of the volume ID.

–storageHost Storage_Host
The storage provider to use this template for. The list candidate storage providers can be obtained by running the powervc-register -o list -r storage command and looking in the ‘Name’ column of the output. If not specified, this template is used to generate the names of all volumes created on any storage providers that are registered in the future.

–restart
Restart the Cinder volume drivers. If this option is not specified, you must manually restart the services to make the changes take effect.

After running this command to set the volume name template for a storage host, any future volumes created for this storage provider will be given a name generated by using the new template.

Example – Set a volume name template for a single storage host.

  1. Find the name of the storage host:
    Test # powervc-register -o list -r storage
    Name                     Display Name             Type
    ====                     ============             ====
    c387f15u41_v7000         svc17                    svc
    
  2. View the current configured volume name template:
    
    Test # powervc-config storage vol-name-format --storageHost c387f15u41_v7000 
    Current volume name template : volume-%(display_name).37s-%(id).13s
    
  3. Specify a new template for the storage provider:
    Test # powervc-config storage vol-name-format --storageHost c387f15u41_v7000 --template 'edit-%(display_name).37s-%(id).13s' --restart
    Restart of cinder services requested.
    The volume name template was successfully updated for provider 'c387f15u41_v7000'.
  4. Verify that the volume name template was set correctly:
    Test # powervc-config storage vol-name-format --storageHost c387f15u41_v7000 
    Current volume name template : edit-%(display_name).37s-%(id).13s

Example – Set the default volume name template

  1. Run the following command to set the default volume name template for all storage hosts registered in the future.
    Test # powervc-config storage vol-name-format --template 'edit-%(display_name).37s-%(id).13s' --restart
    Restart of cinder services requested.
    The volume name template was successfully updated for future storage provider registrations.
  2. Verify that the volume naming template was set correctly.
    Test # powervc-config storage vol-name-format
    Current volume name template : edit-%(display_name).37s-%(id).13s
    
  3. When you create a new volume, PowerVC will use the customized volume name format. You can review the “Storage provider volume name” field on the volume details page to view the volume name.

As you can see, it’s quick and easy to get the volume name of your choice. If you have any questions, post them below. And be sure to follow us on LinkedIn, Twitter, and Facebook so you don’t miss any updates!

Author: Jagdish Choudhary

Join The Discussion

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