From Fedora Project Wiki

Description

Provide cinder-volumes to compute instances

Nova-volume is a service that allows you to give extra block level storage to your OpenStack Compute instances (using iSCSI and LVM)

Setup

Start the SCSI target daemon

$> sudo systemctl start tgtd.service
$> sudo systemctl enable tgtd.service 

How to test

Create a new 5GB volume

$> cinder create --display_name vol-00000001 5

View status of volumes, and wait for it to become 'available'

$> cinder list 
+--------------------------------------+----------+--------------+------+-------------+-------------+
|                  ID                  |  Status  | Display Name | Size | Volume Type | Attached to |
+--------------------------------------+----------+--------------+------+-------------+-------------+
| aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee | creating | vol-00000001 |  5   |     None    |             |
+--------------------------------------+----------+--------------+------+-------------+-------------+


Make the storage available to the instance

$> nova volume-attach testvm aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee /dev/vdc


ssh to the instance and verify that the vdc device is listed in /proc/partitions

$> cat /proc/partitions

Now make the device available if /dev/vdc is not already present

$> mknod /dev/vdc b 252 32

Create and mount a file system directly on the device

$> mkfs.ext3 /dev/vdc
$> mkdir /mnt/nova-volume
$> mount /dev/vdc /mnt/nova-volume

Display some file system details

$> df -h /dev/vdc

Unmount the volume again:

$> umount /mnt/nova-volume

Exit from the ssh session, detach and delete the volume:

$> nova volume-detach testvm aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
$> cinder delete vol-00000001

Expected Results

The file system should be created, mounted and reported correctly by df.

There should be no new errors in the logs:

$> grep -i error /var/log/cinder/*.log