In my last post I went over over-subscription, quality of service (QoS), and compression. If you would like to see that blog article again click here. This time around I will be going over the basic operations that you can carry out using the VMAX drivers for OpenStack Cinder. The operations I will be looking at are:
- Create, list, delete, attach, and detach volumes
- Copying images to/from volumes
- Clone a volume
- Extend a volume
When going through each of the operations, I will include examples of performing that operation using the OpenStack Cinder CLI and at the end of the article there will be a video going over all functionality using the Horizon dashboard. The hope is that by the end you will be fully familiar with each operation and confident to carry them out on your own! With the formalities out of the way, lets begin...
Note: At this point it is assumed that you have fully configured your OpenStack environment for your VMAX and created a VMAX back-end with one or more volume types to provision volumes with.
Create, list, delete, attach, and detach volumes
Provisioning volumes and managing them in OpenStack couldn't be easier using the Cinder CLI or dashboard, it is intuitive and at no point are you left guessing what to do next. The first operation we will look at is creating a volume.
Creating & deleting volumes
When creating a volume there are only a few things you need to know in advance:
- The size of the volume (in GB)
- The name of the volume
- The volume type
If you want to list the volume types you have created in OpenStack use the command cinder type-list. To view your volume types using the dashboard, navigate to Admin>Volume>Volume Types.
To then create a volume, use the following CLI command:
$ cinder create --name <volume_name> --volume-type <vmax_vol_type> <size>
$ cinder create --name vmax_vol1 --volume-type VMAX_ISCSI_DIAMOND 10
To view the details of your newly created volume, use the command:
$ cinder show <volume_id>/<volume_name>
$ cinder show vmax_vol1
To view all of the volumes you have created use the command cinder list. If you want to delete any of the volumes you have created the CLI command is as follows:
$ cinder delete <volume_id>/<volume_name> [<volume_id>/<volume_name>...]
$ cinder delete vmax_vol1
You will notice that in the cinder delete command there is the option to add another volume name or ID, if you want to delete more than one volume at a time you only need list the volumes in the one command, separating each with a space.
$ cinder delete vmax_vol1 vmax_vol2 vmax_vol3
Attaching & detaching volumes
When you have created a volume for use in OpenStack, it is likely that you will want to then attach it to a compute instance for later use. It is assumed here that you already have a running Nova compute instance, it is that instance we will be attaching our VMAX volume to. In advance of this operation you need only to know the instance ID that you would like to attach the volume to, and the volume ID to be attached. If no device mount-point is specified, or the value is set to auto, OpenStack will automatically pick the next available mount-point to attach the volume to.
The required IDs can be obtained using the Nova & Cinder commands # nova list and # cinder list
Taking these IDs, you can attach a volume to the instance using the below Nova command:
$ nova volume-attach <instance_id> <volume_id> [<device>/auto]
$ nova volume-attach ee356911-3855-4197-a1ef-aba3437f6571 28021528-e641-4af6-8984-a6ea0815df7f /dev/vdb
To detach a volume you need only replace 'attach' in the command above with 'detach, there is no need to specify the device mount-point as it is already attached to a mount-point and so not required for detach operations:
$ nova volume-detach <instance_id> <volume_name/volume_id>
$ nova volume-detach ee356911-3855-4197-a1ef-aba3437f6571 vmax_vol1
Copying images to/from volume
Images in OpenStack are pre-configured virtual-machine images which can be used to provision volumes. This is especially useful in production environments, where you can create a master image of a volume, and use that image to provision multiple identical volumes, saving you countless time setting up each.
For this operation it is assumed that you have an image already in OpenStack Glance (image service), any image will do but for this example we are going to use a lightweight CirrOS image. The process is almost identical to provisioning a blank volume, the only difference is the addition of the --image parameter where we can specify the image name we would like to use.
$ cinder create --name <volume_name> --volume-type <vmax_vol_type> --image <image_name>/<image_id> <size>
$ cinder create --name vmax_cirros --volume-type VMAX_ISCSI_DIAMOND --image cirros-0.3.5-x86_64-disk 10
The outcome of the above command will be a new 10GB VMAX volume called 'vmax_cirros', volume type VMAX_ISCSI_DIAMOND, with the CirrOS system image copied to it. When this volume is attached to a Nova compute instance, it can be powered on to run a CirrOS virtual machine.
After setting up this virtual machine with all the necessary packages and environment configuration, it is in a state which can be used for whatever purposes the user has. To avoid having to go through the process of copying the system image to the volume each time, and configuring it as necessary, it is possible to take the configured virtual-machine and turn its present state into an image to be used to provision new virtual machines. To copy a volume to a Glance image, use the command:
$ cinder upload-to-image <volume> <image-name>
$ cinder upload-to-image vmax_cirros cirros_full_config
Cloning a volume
Cloning a volume does exactly what it says on the tin, it take a volume and copies it to make a new volume. The new volume is an exact replica of the volume at that point in time and can be used straight away to perform operations on such as attaching to a compute instance. Just like creating a volume from an image, creating a cloned volume is very similar to the create volume command. The command is the same but this time the additional parameter is --source-volid which lets us specify the source volume that we would like to create a clone from. To create a cloned volume, the command is as follows:
$ cinder create --name <volume_name> --volume-type <vmax_vol_type> --source-volid <volume_id> <size>
$ cinder create --name vmax_cirros_clone --volume-type VMAX_ISCSI_DIAMOND --source-volid 54249fab-3629-4017-becf-1134c7e56cf0 20
The example above will take the CirrOS volume from part 2 of this guide, and creates a bigger volume (20GB) called 'vmax_cirros_clone' with the same volume type as before.
Extending a volume
Extending a volume takes a pre-existing volume and increases its size to a size of your choosing. It is only possible to increase the size of a volume, it is not possible to make a volume smaller than its current size. Extending a volume is really straight forward using the CLI, you only have to specify the volume ID and the size you want to increase it to.
$ cinder extend <volume_id> <new_size>
$ cinder extend 54249fab-3629-4017-becf-1134c7e56cf0 30
To show all of the above operations using the Horizon dashboard, I have created a short demo video. Full-screen viewing of the embedded video is not possible from the DECN website, to view the video full-screen click here or click on the YouTube logo on the video controls to redirect to the video on the YouTube website.
Troubleshooting issues with Volume Management
Working with volumes are one of the most basic operations that can be performed, so luckily when troubleshooting issues in this area we can focus on just a few areas to diagnose what is going on.
The most obvious of issues you could face during volume management is the inability to provision a volume for use. We are going to keep things uncomplicated and say that this volume is a blank volume for now, we can look at bootable volumes later (and if you can't create a bootable volume you should always check if you can still create a blank volume). If you can't create a blank volume you should check the following:
- Is your configuration correct (as outlined in part 1 of this series of blog articles)?
- Have you got the required capacity to provision the volume on the VMAX?
- Have you hit the upper limit for volume storage in OpenStack?
- Have you hit the upper limit for volumes in OpenStack?
- To check your limits from the CLI use the cinder absolute-limits command. You will see the upper limits of each quota and your current usage across all volume types defined in Cinder
If you can create a volume but you can't attach it to a Nova compute instance you need to check the setup of your storage network and if there is successful connectivity between your OpenStack controller/compute nodes and your VMAX storage array. The same checks can be carried out if you are having issues creating a bootable volume, in both cases there is a point in the operation where the VMAX volume needs to be mounted, either for attachment to an instance, or to copy an image to a volume so it can be made bootable. If you can create the volume but fail at the next stage, then it is most likely a storage network issue and most often this issue is connectivity problems between nodes.
What's coming up in part 4 of 'VMAX & OpenStack Ocata: An Inside Look'...
Now you can create and manage basic operations, we can start to look at some of the advanced functionality, next on the list is volume snapshots. We will be taking a look at what snapshots are, the advantages of having SnapVX backed snapshots, and how to work with them using the same methods we covered in this article.