Monday 9 June 2014

Steps to create a volume in Cinder and attach it to an OpenStack instance




[Steps summarised from http://docs.openstack.org/user-guide/content/cli_manage_volumes.html]



Prerequisites

Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-setup-openstack-command-line.html to create an instance in OpenStack.



Set environment for your specific user and tenant

# source ~/keystonerc_<user-name>



Change the iptables rule for Cinder to allow command line access from an IP other than the OpenStack Controller Node

On the Controller node, in file /etc/sysconfig/iptables, remove the line
-A INPUT -s 192.168.2.6/32 -p tcp -m multiport --dports 3260,8776 -m comment --comment "001 cinder incoming cinder_192.168.2.6" -j ACCEPT

and in its place, add the line
-A INPUT -p tcp -m multiport --dports 3260,8776 -m comment --comment "Cinder incoming ALL" -j ACCEPT

Restart iptables service to enable the change
# service iptables restart



Create a 10GB Volume

# cinder create 10 --display-name <my-new-volume>



Gather required parameters

# cinder list
Note the <volume-ID> in the ID column of the list displayed. Make sure the "Attached to" column is empty.

# nova list
Note the <instance-ID> in the ID column of the list displayed. This will be the ID of the instance.



Attach the volume to the instance

# nova volume-attach <instance-ID> <volume-ID> <volume-drive-device>



SSH into the new instance using the floating IP and the private key file for <key-name>

# ssh -i <my-key>.pem <user-name>@<floating-IP>

Use fdisk to list the devices attached to the instance

# sudo fdisk -l



No comments:

Post a Comment