2017年3月8日星期三

Setup IBM Storwize for OpenStack Cinder and Glance

This blog post shows in simple steps how to configure the IBM Storwize to use in OpenStack Cinder and Glance.

Cinder
Cinder uses the storwize driver to connect to the storage and create volumes in a pre-configured pool.

image
 




The configuration for Cinder is straight forward. An example of storwize settings in cinder.conf follows:
volume_driver=cinder.volume.drivers.ibm.storwize_svc.StorwizeSVCDriver
san_ip=192.168.0.1
san_login=<admin_user>
san_password=<password>
ssh_max_pool_conn=5
ssh_conn_timeout=30
ssh_min_pool_conn=1
san_thin_provision=True
volume_backend_name=DEFAULT
san_ssh_port=22
san_clustername=Cinder
san_is_local=False
storwize_svc_volpool_name=power-cloud
storwize_svc_iscsi_chap_enabled=False

More details on the storwize options for Cinder (on OpenStack Juno release) can be found at http://docs.openstack.org/juno/config-reference/content/ibm-storwize-svc-driver2.html.

Restart Cinder services:
$ for serv in api scheduler volume; do service cinder-$serv restart; done


To confirm the volumes are created on the storage pool, create a test volume and check in the storage pool:

$ cinder create --display-name rfolco 48
+---------------------+--------------------------------------+
|       Property      |                Value                 |
+---------------------+--------------------------------------+
|     attachments     |                  []                  |
|  availability_zone  |                 nova                 |
|       bootable      |                false                 |
|      created_at     |      2015-01-23T19:41:03.313666      |
| display_description |                 None                 |
|     display_name    |                rfolco                |
|      encrypted      |                False                 |
|          id         | abc3ad3c-91e8-4f8e-8bdc-ac40a7a4bc12 |
|       metadata      |                  {}                  |
|         size        |                  48                  |
|     snapshot_id     |                 None                 |
|     source_volid    |                 None                 |
|        status       |               creating               |
|     volume_type     |                 None                 |
+---------------------+--------------------------------------+


$ cinder list
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
|                  ID                  |   Status  | Display Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| abc3ad3c-91e8-4f8e-8bdc-ac40a7a4bc12 | available |    rfolco    |  48  |     None    |  false   |             |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
The volumes created by Cinder are visible on the storage management:
image

 


Glance
The Stowize setup for Glance requires a storage pool and a volume mapped to the target host. In this case, the volume will be manually created and used to store images and snapshots from Glance.

image



Once the volume is created it needs to be mapped to a host using the port name (iqn) generated in the host. The iscsi commands shown in this example were issued in a Ubuntu controller but also work on Fedora, RHEL and SLES.

# cat /etc/iscsi/initiatorname.iscsi |grep iqn
InitiatorName=iqn.1993-08.org.debian:01:6a8c76536058

 image


The following commands discover and login into the storage node. Notice that the portal IP address is different from the management interface.

# iscsiadm --mode discovery --type sendtargets --portal <portal_ip>
<portal_ip>:3260,1 iqn.1986-03.com.ibm:2145.v7000.node1
<portal_ip>:3260,1 iqn.1986-03.com.ibm:2145.v7000.node1

# sudo iscsiadm --mode node --targetname iqn.1986-03.com.ibm:2145.v7000.node1 --portal <portal_ip1> --login
Logging in to [iface: default, target: iqn.1986-03.com.ibm:2145.v7000.node1, portal: <portal_ip>,3260] (multiple)
Login to [iface: default, target: iqn.1986-03.com.ibm:2145.v7000.node1, portal: <portal_ip>,3260] successful.



To logout from the storage node, use:

# iscsiadm --mode node --logoutall=all
Logging out of session [sid: 3, target: iqn.1986-03.com.ibm:2145.v7000.node1, portal: <portal_ip>,3260]
Logout of [sid: 3, target: iqn.1986-03.com.ibm:2145.v7000.node1, portal: <portal_ip>,3260] successful.



The disk now shows up in the system, as shown below:


Model: IBM 2145 (scsi)
Disk /dev/sdc: 3299GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name              Flags
 1      1049kB  3299GB  3299GB  ext4         Linux filesystem



In this case, the disk size is 3TB, and fdisk doesn't support GPT partitions (>2TB). Use parted or gdisk tools to create a GPT partition.
Then format the disk with ext4:
# mkfs.ext4 /dev/sdc1

Mount the disk and make it persistent on reboots:

# mkdir /var/lib/glance/storage
# chown glance:glance /var/lib/glance/storage

# mount /dev/sdc1  /var/lib/glance/storage


# cat /etc/fstab |grep sdc
/dev/sdc1    /var/lib/glance/storage    ext4    defaults    0    1



Finally, configure Glance to use the storage volume:

Edit /etc/glance/glance-api.conf if you change the default glance location:
filesystem_store_datadir = /var/lib/glance/storage/

Restart glance services:
$ for serv in api registry cache; do service glance-$serv restart; done

Done! The IBM Storwize has been configured for Cinder and Glance.

 


Tags:  #storwize #cinder #v7000 #openstack #storage #glance
地点: 中国浙江省杭州市西湖区