Now that we have created a Cinder volume service, we can create volumes for use by our instances. We do this under our Ubuntu client using one of the Cinder client tools, python-cinderclient
, so we are creating volumes specific to our tenancy (project).
To begin with, ensure you are logged in to your Ubuntu client that has access to the Cinder client tools. If using the Vagrant environment that accompanies the book, you can access these tools from the cinder
node:
vagrant ssh cinder
This recipe assumes you have created an openrc
file. To create an openrc
file on each node where you need it, open a text file named openrc
and add the following contents:
export OS_TENANT_NAME=cookbook export OS_USERNAME=admin export OS_PASSWORD=openstack export OS_AUTH_URL=https://192.168.100.200:5000/v2.0/ export OS_KEY=/path/to/cakey.pem export OS_CACERT=/path/to/ca.pem
These packages can be installed using the following command:
sudo apt-get update sudo apt-get install python-cinderclient
Carry out the following steps to create a volume using Cinder client:
source openrc cinder create --display-name cookbook 1
Creating Cinder volumes for use within our project, cookbook
, is very straightforward.
With the Cinder client, we use the create
option with the following syntax:
cinder create --display_name volume_name size_Gb
Here, volume_name
can be any arbitrary name with no spaces. We can see the actual LVM volumes on cinder-volumes
, using the usual LVM tools, as follows:
sudo lvdisplay cinder-volumes
You will get the following output:
Notice the LV
name matches the ID of the volume created with Cinder.