From zero to presented lun in Linux with 3par cli

TAGS: 3par linux

Intro

Mission: Create cpg / virtual volume / host / vlun via hp 3par cli and detect it in Linux

Overview

WE experienced some troubles with cinder backend for glance_store so decided to go with file store on presented 3par luns instead. But none of us had any experience with 3par / scsi / fc :)

Preparation

You’ll need admin privileges in storage and 3par cli. Also you’ll need access to target linux host (dmesg/ mount etc).
On linux host you’ll need configured and running multipathd (device-mapper-multipath package).

3PAR

Log into 3par via ssh and start creating all needed resources
show all ports, cpg, hosts, vvs, vluns showport; showcpg; showhost; showvv; showvlun check free space (FC for fibrechannel) showspace -p -devtype FC create cfg (raid6) createcpg -t r6 -ha cage -ssz 6 mcs_glance #raid6, mcs_glance - name create virtual volume createvv -tpvv -pol zero_detect mcs_glance glance_vv1 1000G present volume to target host (url-esxw-zoo001) with id=15 createvlun glance_vv1 15 url-esxw-zoo001 I strongly recommend to specufy ane ID values like 15 instead ‘auto’ cause first auto ID is 0 and it can be reserved after Ilo or some other hardware.
Now u can checked n:s:p
showvlun -host url-esxw-zoo001
Full cli reference can be obtained here: link

Target linux host

Log into target host and issue command: echo "0 6 15" > /sys/class/scsi_host/host1/scan where 1 - host
0 - channel of hba
6 - scsi target id
15 - lun ID check dmesg -T output: [Thu Apr 22 14:39:39 2021] sd 1:0:6:15: Power-on or device reset occurred [Thu Apr 22 14:39:39 2021] sd 1:0:6:15: Attached scsi generic sg54 type 0 [Thu Apr 22 14:39:39 2021] sd 1:0:6:15: alua: transition timeout set to 60 seconds [Thu Apr 22 14:39:39 2021] sd 1:0:6:15: alua: port group 01 state A preferred supports tolusnA [Thu Apr 22 14:39:39 2021] sd 1:0:6:15: [sday] 2097152000 512-byte logical blocks: (1.07 TB/1000 GiB) [Thu Apr 22 14:39:39 2021] sd 1:0:6:15: [sday] Write Protect is off [Thu Apr 22 14:39:39 2021] sd 1:0:6:15: [sday] Mode Sense: 8b 00 10 08 [Thu Apr 22 14:39:39 2021] sd 1:0:6:15: [sday] Write cache: disabled, read cache: enabled, supports DPO and FUA [Thu Apr 22 14:39:39 2021] sd 1:0:6:15: [sday] Optimal transfer size 16777216 bytes [Thu Apr 22 14:39:39 2021] sd 1:0:6:15: [sday] Attached SCSI disk Here we can see path as 1:0:6:15, where: 1 - host 0 - node 6 - target 15 -id
Check lsblk output: lsblk | grep sday sday 67:32 0 1000G 0 disk To add this lun multipath lets issue full rescan echo "- - -" > /sys/class/scsi_host/host1/scan echo "- - -" > /sys/class/scsi_host/host2/scan Now this lun presented in mu;tipath multipath -l | grep sday |- 1:0:6:15 sday 67:32 active undef running`

Mkfs mount etc

list multipath device:
360002ac0000000000000009b0001578b dm-13 3PARdata,VV size=1000G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw `- - policy='service-time 0' prio=50 status=active |- 1:0:6:15 sday 67:32 active ready running |- 2:0:6:15 sdaz 67:48 active ready running |- 2:0:10:15 sdba 67:64 active ready running `- 1:0:8:15 sdbb 67:80 active ready running

Find out its path on /dev/ subsystem ls -la /dev/mapper/ total 0 drwxr-xr-x. 2 root root 340 Apr 22 15:16 . drwxr-xr-x. 20 root root 5780 Apr 22 15:18 .. lrwxrwxrwx. 1 root root 8 Apr 22 15:18 360002ac0000000000000009b0001578b -> ../dm-13

Make filesystem
mkfs.xfs /dev/mapper/360002ac0000000000000009b0001578b Discarding blocks...Done. meta-data=/dev/mapper/360002ac0000000000000009b0001578b isize=512 agcount=32, agsize=8191996 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0 data = bsize=4096 blocks=262143872, imaxpct=25 = sunit=4 swidth=4096 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal log bsize=4096 blocks=128000, version=2 = sectsz=512 sunit=4 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0

Create mountpoint
mkdir /var/lib/glance

Find out multipath device uuid, create entry in fstab
ls -la /dev/disk/by-uuid/ total 0 drwxr-xr-x. 2 root root 240 Apr 22 15:38 . drwxr-xr-x. 8 root root 160 Apr 9 13:15 .. lrwxrwxrwx. 1 root root 11 Apr 22 15:38 5e575806-37a4-49fc-b8dc-182abc8d749f -> ../../dm-13

vi /etc/fstab UUID=5e575806-37a4-49fc-b8dc-182abc8d749f /var/lib/glance xfs defaults 0 0

mount device ``mount -a

mount | grep glance

/dev/mapper/360002ac0000000000000009b0001578b on /var/lib/glance type xfs (rw,relatime,seclabel,attr2,inode64,sunit=32,swidth=32768,noquota)

df -h | grep glanc

/dev/mapper/360002ac0000000000000009b0001578b 1000G 34M 1000G 1% /var/lib/glance``

Docker volume case

You can create docker volume instead using mountdirecoty with fstab (helpful for kolla-ansible for example)
docker volume create --driver local --opt type=xfs --opt device=/dev/mapper/360002ac0000000000000009b0001578b glance

Written on April 22, 2021

Archive

linux openstack kubernetes gluster ceph ansible docker systemctl python openshift log centos sed registry kolla kibana keepalived elasticsearch deploy cloud-init auth HA zabbix vsphere vmware venv tools swift ssl ssh scm ruby rsyslog rhel rbac rabbitmq prometheus postgres policy pgpool2 patrole pacemaker ntp nfs net mq monitoring mongo mbr lvm logstash kubespray kubeadm kolla-ansible jenkins jekyII java ironic helm heketi harbor grub github ganesha fluentd fluent-bit fio drbd diskimage-builder devstack debug deb db cisco cicd ceph-ansible calico build bitbucket benchmarking apparmor api NUMA Linux Golang Go ELK 3par