Site icon UnixArena

Openstack – Configure Cinder Service (Testing Method)

Cinder  is the  default block storage service on Openstack. Cinder service manages the volumes , volume snapshots, and volume types. Prior to year 2012 , cinder was part of nova module in the name of nova-volume. To reduce the nova coding and improve the volume service, developers has separated the volume service from nova codes and they named volume service as cinder. Since then , multiple vendors are started providing the API to the cinder services. By default , cinder uses the LVM as back-end storage system.  The default configuration file is /etc/cinder/cinder.conf. In this article, I will demonstrate that how to use the cinder service on Openstack which is configured using devstack method.

There are three important components in cinder block service.

Cinder act like a front-end interface and communicate to LVM or Ceph using the API in the back-end to provide the volume services. Ceph is the advanced storage which eliminates the limitations of LVM.

Cinder architecture

 

Note:  In my case, both Openstack controller node & cinder nodes are same. Created this environment using the devstack method on Ubuntu.

Configure the cinder: (Only for the testing purpose )

Note: Since I have logged in as stack user , Need to use sudo command to get the necessary privileges.

1.Let’s have dedicated harddrive for cinder.

stack@uacloud:~$ sudo  fdisk -l /dev/sdb

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders, total 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table
stack@uacloud:~$

 

2. Install the lvm2 packages. (In my case, lvm2 is already installed)

stack@uacloud:~$ sudo apt-get install lvm2
Reading package lists... Done
Building dependency tree
Reading state information... Done
lvm2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 17 not upgraded.
stack@uacloud:~$

 

3. Create the physical volume using the /dev/sdb.

stack@uacloud:~$ sudo pvcreate /dev/sdb
  Physical volume "/dev/sdb" successfully created
stack@uacloud:~$
stack@uacloud:~$ sudo pvs
  PV         VG                        Fmt  Attr PSize  PFree
  /dev/loop0 stack-volumes-lvmdriver-1 lvm2 a--  10.01g 10.01g
  /dev/sdb                             lvm2 a--  10.00g 10.00g
stack@uacloud:~$

 

4. Create the volume group using /dev/sdb.

stack@uacloud:~$ sudo  vgcreate stack-vg /dev/sdb
  Volume group "stack-vg" successfully created
stack@uacloud:~$ sudo vgs
  VG                        #PV #LV #SN Attr   VSize  VFree
  stack-vg                    1   0   0 wz--n- 10.00g 10.00g
  stack-volumes-lvmdriver-1   1   0   0 wz--n- 10.01g 10.01g
stack@uacloud:~$

 

5. Edit the cinder.conf like below. Just replaced volume group name as stack-vg.

stack@uacloud:~$ cat /etc/cinder/cinder.conf |grep group
volume_group = stack-volumes-lvmdriver-1
stack@uacloud:~$ cp /etc/cinder/cinder.conf /etc/cinder/cinder.conf.08092015
stack@uacloud:~$ vi /etc/cinder/cinder.conf
stack@uacloud:~$ cat /etc/cinder/cinder.conf |grep group
volume_group = stack-vg
stack@uacloud:~$

 

6. Run unstack.sh & re-join.sh to restart all the openstack services.

stack@uacloud:~/devstack$ ./unstack.sh
Site keystone disabled.
To activate the new configuration, you need to run:
  service apache2 reload
 * Stopping web server apache2                                                                                                                                           *
 * Starting web server apache2                                                                                                                                          AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
 *
pkill: killing pid 42051 failed: Operation not permitted
pkill: killing pid 42055 failed: Operation not permitted
 * Stopping web server apache2                                                                                                                                           *
tgt stop/waiting
stack@uacloud:~/devstack$ ./rejoin-stack.sh
[detached from 48132.stack]
stack@uacloud:~/devstack$

 

8. Login to Openstack Dashboard to use the first cinder volume. If you unable to get the Dashboard, restart the Apache services like below.

stack@uacloud:~/devstack$ sudo   service apache2 restart
 * Restarting web server apache2                                                                                                                                                                                                                                                                                               [ OK ]
stack@uacloud:~/devstack$

 

9. By default, nova instance creates the image file under below mentioned location when you launch the instance (using image).

stack@uacloud:~$ cd data/nova/instances/
stack@uacloud:~/data/nova/instances$ ls -lrt
total 16
-rw-rw-r-- 1 stack stack   30 Sep  8 21:56 compute_nodes
drwxrwxr-x 2 stack stack 4096 Sep  8 22:34 locks
drwxrwxr-x 2 stack stack 4096 Sep  8 22:34 _base
drwxrwxr-x 2 stack stack 4096 Sep  8 22:34 cb52c5ac-869f-498c-8457-d0204b8cb756
stack@uacloud:~/data/nova/instances$ cd cb52c5ac-869f-498c-8457-d0204b8cb756/
stack@uacloud:~/data/nova/instances/cb52c5ac-869f-498c-8457-d0204b8cb756$ ls -lrt
total 19056
-rw-rw-r-- 1 root  root   4969360 Sep  8 22:34 kernel
-rw-rw-r-- 1 root  root   3723817 Sep  8 22:34 ramdisk
-rw-rw-r-- 1 root  root    419840 Sep  8 22:34 disk.config
-rw-r--r-- 1 stack stack      347 Sep  8 22:34 disk.info
-rw-rw-r-- 1 stack stack     2920 Sep  8 22:34 libvirt.xml
-rw-rw---- 1 root  root     17283 Sep  8 22:34 console.log
-rw-r--r-- 1 root  root  10420224 Sep  8 22:35 disk
stack@uacloud:~/data/nova/instances/cb52c5ac-869f-498c-8457-d0204b8cb756$ 

 

10. Since we have configured the cinder , Let’s create new instance on cinder volume. Login to the Openstack dashboard & Launch instance.

Use Volume for Nova instance

 

11.  Click on Access & security to map the right key pairs & security profile.

Use Volume for Nova instance

 

12.  Here you can see that instance has been created using the cinder volume.

Instance is up

 

13.  Navigate to the volumes tab.  Here you can see that volume is created and attached to the instance “vua02”. Since  it is a OS volume , so marked as  bootable.  (Right side)

Volume’s Tab

 

There was an issue while configuring the cinder service where I am unable to create a new volume using the dashboard. But I was able to create the volume using “cinder create 1” using command line. To fix this , I have re-installed the ISCSI packages. (Ubuntu)

# apt-get install iscsitarget-dkms --reinstall
# apt-get install iscsitarget --reinstall

 

14. Let’s see how it has been created in the back-end.  List the cinder volume .

stack@uacloud:~/devstack$ cinder list
+--------------------------------------+--------+------+------+-------------+----------+--------------------------------------+
|                  ID                  | Status | Name | Size | Volume Type | Bootable |             Attached to              |
+--------------------------------------+--------+------+------+-------------+----------+--------------------------------------+
| e7b408ee-96dd-4453-9e0e-3086a694a652 | in-use |      |  1   | lvmdriver-1 |   true   | de53f0a5-f8a0-4c43-85f6-8cdd0c169134 |
+--------------------------------------+--------+------+------+-------------+----------+--------------------------------------+
stack@uacloud:~/devstack$

 

In the back-end , cinder service communicates to the LVM driver & create the volumes on the specified volume group (Refer Step 5).

stack@uacloud:~/devstack$ sudo lvs
  LV                                          VG                        Attr      LSize Pool Origin Data%  Move Log Copy%  Convert
  volume-e7b408ee-96dd-4453-9e0e-3086a694a652 cinder-volumes            -wi-ao--- 1.00g
stack@uacloud:~/devstack$

 

Hope this article is informative to you.

Exit mobile version