Saturday, November 08, 2014

LVMiSCSI cinder backend for RDO Juno on CentOS 7

Current post follows up http://lxer.com/module/newswire/view/207415/index.html
RDO Juno has been intalled on Controller and Compute nodes via packstack as described in link @lxer.com. iSCSI target (Server) implementation on CentOS 7 differs significantly from CentOS 6.5 and is based on  CLI utility targetcli and service target.
   With Enterprise Linux 7, both Red Hat and CentOS, there is a big change in the management of iSCSI targets.Software run as part of the standard systemd structure. Consequently there will be significant changes in multi back end cinder architecture of RDO Juno running on CentOS 7 or Fedora 21 utilizing LVM
based iSCSI targets.

  Create following entries in /etc/cinder/cinder.conf on Controller ( which in case of two node Cluster works as Storage node as well).

First entry id [DEFAULT] section

#######################
enabled_backends=lvm51,lvm52
#######################

At the bottom of file

[lvm51]
iscsi_helper=lioadm
volume_group=cinder-volumes51
volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver
iscsi_ip_address=192.168.1.127
volume_backend_name=LVM_iSCSI51


[lvm52]
iscsi_helper=lioadm
volume_group=cinder-volumes52
volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver
iscsi_ip_address=192.168.1.127
volume_backend_name=LVM_iSCSI52
 

VG cinder-volumes52,51 created on /dev/sda6 and /dev/sdb1 correspondently :-

# pvcreate /dev/sda6
# pvcreate /dev/sdb1
# vgcreate cinder-volumes52 /dev/sda6
# vgcreate cinder-volumes51  /dev/sdb1

Then issue :-

[root@juno1 ~(keystone_admin)]# cinder type-create lvms
+--------------------------------------+------+
|                  ID                  | Name |
+--------------------------------------+------+
| 64414f3a-7770-4958-b422-8db0c3e2f433 | lvms  |
+--------------------------------------+------+


[root@juno1 ~(keystone_admin)]# cinder type-create lvmz +--------------------------------------+---------+
|                  ID                  |   Name  |
+--------------------------------------+---------+
| 29917269-d73f-4c28-b295-59bfbda5d044 | lvmz |

+--------------------------------------+---------+

[root@juno1 ~(keystone_admin)]# cinder type-list
+--------------------------------------+---------+
|                  ID                  |   Name  |
+--------------------------------------+---------+
| 29917269-d73f-4c28-b295-59bfbda5d044 |  lvmz   |
| 64414f3a-7770-4958-b422-8db0c3e2f433 |  lvms   |
+--------------------------------------+---------+


[root@juno1 ~(keystone_admin)]# cinder type-key lvmz set volume_backend_name=LVM_iSCSI51

[root@juno1 ~(keystone_admin)]# cinder type-key lvms set volume_backend_name=LVM_iSCSI52



Then enable and start service target:-

   [root@juno1 ~(keystone_admin)]#   service target enable
   [root@juno1 ~(keystone_admin)]#   service target start

[root@juno1 ~(keystone_admin)]# service target status
Redirecting to /bin/systemctl status  target.service
target.service - Restore LIO kernel target configuration
   Loaded: loaded (/usr/lib/systemd/system/target.service; enabled)
   Active: active (exited) since Wed 2014-11-05 13:23:09 MSK; 44min ago
  Process: 1611 ExecStart=/usr/bin/targetctl restore (code=exited, status=0/SUCCESS)
 Main PID: 1611 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/target.service


Nov 05 13:23:07 juno1.localdomain systemd[1]: Starting Restore LIO kernel target configuration...
Nov 05 13:23:09 juno1.localdomain systemd[1]: Started Restore LIO kernel target configuration.

Now all changes done by creating cinder volumes of types lvms,lvmz ( via
dashboard - volume create with dropdown menu volume types or via cinder CLI )
will be persistent in  targetcli> ls output between reboots

[root@juno1 ~(keystone_boris)]# cinder list
+--------------------------------------+--------+------------------+------+-------------+----------+--------------------------------------+
|                  ID                  | Status |   Display Name   | Size | Volume Type | Bootable |             Attached to              |
+--------------------------------------+--------+------------------+------+-------------+----------+--------------------------------------+
| 3a4f6878-530a-4a28-87bb-92ee256f63ea | in-use | UbuntuUTLV510851 |  5   |     lvmz    |   true   | efb1762e-6782-4895-bf2b-564f14105b5b |
| 51528876-405d-4a15-abc2-61ad72fc7d7e | in-use |   CentOS7LVG51   |  10  |     lvmz    |   true   | ba3e87fa-ee81-42fc-baed-c59ca6c8a100 |
| ca0694ae-7e8d-4c84-aad8-3f178416dec6 | in-use |  VF20LVG520711   |  7   |     lvms    |   true   | 51a20959-0a0c-4ef6-81ec-2edeab6e3588 |
| dc9e31f0-b27f-4400-a666-688365126f67 | in-use | UbuntuUTLV520711 |  7   |     lvms    |   true   | 1fe7d2c3-58ae-4ee8-8f5f-baf334195a59 |
+--------------------------------------+--------+------------------+------+-------------+----------+--------------------------------------+


    Compare 'green' highlighted volume id's and tarcgetcli>ls output

 



  

  
   Next snapshot demonstrates lvms && lvmz volumes attached to corresponding
   nova instances utilizing LVMiSCSI cinder backend.

   

On Compute Node iscsiadm output will look as follows :-

[root@juno2 ~]# iscsiadm -m discovery -t sendtargets -p 192.168.1.127
192.168.1.127:3260,1 iqn.2010-10.org.openstack:volume-3a4f6878-530a-4a28-87bb-92ee256f63ea
192.168.1.127:3260,1 iqn.2010-10.org.openstack:volume-ca0694ae-7e8d-4c84-aad8-3f178416dec6
192.168.1.127:3260,1 iqn.2010-10.org.openstack:volume-dc9e31f0-b27f-4400-a666-688365126f67
192.168.1.127:3260,1 iqn.2010-10.org.openstack:volume-51528876-405d-4a15-abc2-61ad72fc7d7e


References
1.  https://www.centos.org/forums/viewtopic.php?f=47&t=48591