ClusterLabs / resource-agents

Combined repository of OCF agents from the RHCS and Linux-HA projects
GNU General Public License v2.0
493 stars 580 forks source link

iSCSILogicalUnit don't set the correct sn #1256

Open colttt opened 5 years ago

colttt commented 5 years ago

Hello, when I've multiple LUNs, the iSCSILogicalUnit-agent set only for the first LUN the correct sn, all others get a different one, I guess something is wrong in Line 419 or so. It looks like that only the first sn will be set correct, I add some echo's output to the iSCSILogicalUnit script:

diff /usr/lib/ocf/resource.d/heartbeat/iSCSILogicalUnit iSCSILogicalUnit.org
49,51d48
< echo "" >> /tmp/iscsilun_debug.log
< echo date >> /tmp/iscsilun_debug.log
< 
62d58
< echo ${OCF_RESOURCE_INSTANCE} >> /tmp/iscsilun_debug.log
64,65d59
< echo -n "die sn:  " >> /tmp/iscsilun_debug.log
< echo $sn >> /tmp/iscsilun_debug.log
68,69d61
< echo -n "die ocf_sn:  " >> /tmp/iscsilun_debug.log
< echo $OCF_RESKEY_scsi_sn >> /tmp/iscsilun_debug.log
417,418d408
<               echo -n "vor if reskey_sn:  " >> /tmp/iscsilun_debug.log
<               echo ${OCF_RESKEY_scsi_sn} >> /tmp/iscsilun_debug.log
421,422d410
<                       echo -n "in if schleife:  " >> /tmp/iscsilun_debug.log
<                       cat /sys/kernel/config/target/core/iblock_${OCF_RESKEY_lio_iblock}/${OCF_RESOURCE_INSTANCE}/wwn/vpd_unit_serial  >> /tmp/iscsilun_debug.log
447d434
<               echo "fertig ........................" >> /tmp/iscsilun_debug.log

the output is:

date
iscsi-lun0
die sn:  d0e5396557d77dc7ba590376f1bf5b0f
die ocf_sn:  d0e53965
vor if reskey_sn:  d0e53965
in if schleife:  T10 VPD Unit Serial Number: d0e53965
fertig ........................

date
iscsi-lun1
die sn:  db01ac2635d5fd02aa628af69b9542fc
die ocf_sn:  db01ac26
vor if reskey_sn:  db01ac26
in if schleife:  fertig ........................

date
iscsi-lun2
die sn:  0acb0780261a5de6f191831f74a13a80
die ocf_sn:  0acb0780
vor if reskey_sn:  0acb0780
in if schleife:  fertig ........................

(some other errors here but for quick and dirty its ok) so I will look deeper into it

colttt commented 5 years ago

a new diff:

diff /usr/lib/ocf/resource.d/heartbeat/iSCSILogicalUnit iSCSILogicalUnit.org
49,51d48
< echo "" >> /tmp/iscsilun_debug.log
< date >> /tmp/iscsilun_debug.log
< 
62d58
< echo ${OCF_RESOURCE_INSTANCE} >> /tmp/iscsilun_debug.log
64,65d59
< echo -n "die sn:  " >> /tmp/iscsilun_debug.log
< echo $sn >> /tmp/iscsilun_debug.log
68,69d61
< echo -n "die ocf_sn:  " >> /tmp/iscsilun_debug.log
< echo $OCF_RESKEY_scsi_sn >> /tmp/iscsilun_debug.log
417,418d408
<               echo -n "vor if reskey_sn:  " >> /tmp/iscsilun_debug.log
<               echo ${OCF_RESKEY_scsi_sn} >> /tmp/iscsilun_debug.log
420,425c410
<                       echo -n "path is:   " >> /tmp/iscsilun_debug.log
<                       echo "/sys/kernel/config/target/core/iblock_${OCF_RESKEY_lio_iblock}/${OCF_RESOURCE_INSTANCE}/wwn/vpd_unit_serial" >> /tmp/iscsilun_debug.log
<                       ls /sys/kernel/config/target/core/iblock_${OCF_RESKEY_lio_iblock}/${OCF_RESOURCE_INSTANCE}/wwn/vpd_unit_serial >> /tmp/iscsilun_debug.log 2>&1
<                       echo ${OCF_RESKEY_scsi_sn} > /sys/kernel/config/target/core/iblock_${OCF_RESKEY_lio_iblock}/${OCF_RESOURCE_INSTANCE}/wwn/vpd_unit_serial >> /tmp/iscsilun_debug.log 2>&1
<                       echo -n "in if schleife:  " >> /tmp/iscsilun_debug.log
<                       cat /sys/kernel/config/target/core/iblock_${OCF_RESKEY_lio_iblock}/${OCF_RESOURCE_INSTANCE}/wwn/vpd_unit_serial  >> /tmp/iscsilun_debug.log
---
>                       echo ${OCF_RESKEY_scsi_sn} > /sys/kernel/config/target/core/iblock_${OCF_RESKEY_lio_iblock}/${OCF_RESOURCE_INSTANCE}/wwn/vpd_unit_serial
450d434
<               echo "fertig ........................" >> /tmp/iscsilun_debug.log

output:

Thu Oct 25 08:39:23 CEST 2018
iscsi-lun0
die sn:  d0e5396557d77dc7ba590376f1bf5b0f
die ocf_sn:  d0e53965
vor if reskey_sn:  d0e53965
path is:   /sys/kernel/config/target/core/iblock_0/iscsi-lun0/wwn/vpd_unit_serial
/sys/kernel/config/target/core/iblock_0/iscsi-lun0/wwn/vpd_unit_serial
d0e53965
in if schleife:  T10 VPD Unit Serial Number: b8133fc2-cebb-4455-8a33-1337b178bad3
fertig ........................

Thu Oct 25 08:39:24 CEST 2018
iscsi-lun1
die sn:  db01ac2635d5fd02aa628af69b9542fc
die ocf_sn:  db01ac26
vor if reskey_sn:  db01ac26
path is:   /sys/kernel/config/target/core/iblock_0/iscsi-lun1/wwn/vpd_unit_serial
ls: cannot access '/sys/kernel/config/target/core/iblock_0/iscsi-lun1/wwn/vpd_unit_serial': No such file or directory
in if schleife:  fertig ........................

Thu Oct 25 08:39:25 CEST 2018
iscsi-lun2
die sn:  0acb0780261a5de6f191831f74a13a80
die ocf_sn:  0acb0780
vor if reskey_sn:  0acb0780
path is:   /sys/kernel/config/target/core/iblock_0/iscsi-lun2/wwn/vpd_unit_serial
ls: cannot access '/sys/kernel/config/target/core/iblock_0/iscsi-lun2/wwn/vpd_unit_serial': No such file or directory
in if schleife:  fertig ........................

he dont use the correct iblock_number, so the variable ${OCF_RESKEY_lio_iblock} is wrong