Wrong Variable name in iSCSILogicalUnit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

 

I have been trying to create a HA iSCSILogicalUnit resource and think I have come across a bug caused by a wrong variable name.

 

I have been using the master branch from cluster labs for my iSCSILogicalUnit resource agent running on Ubuntu 14.04.

 

Whilst the LUN and Target are correctly created by the agent when stopping the agent it was only removing the target, which cleared the LUN but left the iBlock device. This was then locking the underlying block device as it was still in use.

 

After spedning a fair while trawling through the agent I beleive I have discovered the problem, at least the change I made has fixed it for me.

 

In the monitor and stop actions there is a check which uses the wrong variable,  OCF_RESKEY_INSTANCE instead of OCF_RESOURCE_INSTANCE. I also found a “#{“ in front of one of the variables that prepares the path string for removing the LUN. I have also added a few more log entries to give a clearer picture of what is happening during removal, which made the debugging process much easier.

 

 

Below is a Diff which seems to fix the problem for me:-

 

 

+++ /usr/lib/ocf/resource.d/heartbeat/iSCSILogicalUnit  2014-09-17 16:40:23.208764599 +0100

@@ -419,12 +419,14 @@

                                        ${initiator} ${OCF_RESKEY_lun} || exit $OCF_ERR_GENERIC

                        fi

                done

-               lun_configfs_path="/sys/kernel/config/target/iscsi/${OCF_RESKEY_target_iqn}/tpgt_1/lun/lun_#{${OCF_RESKEY_lun}/"

+               lun_configfs_path="/sys/kernel/config/target/iscsi/${OCF_RESKEY_target_iqn}/tpgt_1/lun/lun_${OCF_RESKEY_lun}/"

                if [ -e "${lun_configfs_path}" ]; then

+                       ocf_log info "Deleting LUN ${OCF_RESKEY_target_iqn}/${OCF_RESKEY_lun}"

                        ocf_run lio_node --dellun=${OCF_RESKEY_target_iqn} 1 ${OCF_RESKEY_lun} || exit $OCF_ERR_GENERIC

                fi

-               block_configfs_path="/sys/kernel/config/target/core/iblock_${OCF_RESKEY_lio_iblock}/${OCF_RESKEY_INSTANCE}/udev_path"

+               block_configfs_path="/sys/kernel/config/target/core/iblock_${OCF_RESKEY_lio_iblock}/${OCF_RESOURCE_INSTANCE}/udev_path"

                if [ -e "${block_configfs_path}" ]; then

+                       ocf_log info "Deleting iBlock Device iblock_${OCF_RESKEY_lio_iblock}/${OCF_RESOURCE_INSTANCE}"

                        ocf_run tcm_node --freedev=iblock_${OCF_RESKEY_lio_iblock}/${OCF_RESOURCE_INSTANCE} || exit $OCF_ERR_GENERIC

                fi

                ;;

@@ -478,7 +480,7 @@

                [ -e ${configfs_path} ] && [ `cat ${configfs_path}` = "${OCF_RESKEY_path}" ] && return $OCF_SUCCESS

 

                # if we aren't activated, is a block device still left over?

-               block_configfs_path="/sys/kernel/config/target/core/iblock_${OCF_RESKEY_lio_iblock}/${OCF_RESKEY_INSTANCE}/udev_path"

+               block_configfs_path="/sys/kernel/config/target/core/iblock_${OCF_RESKEY_lio_iblock}/${OCF_RESOURCE_INSTANCE}/udev_path"

                [ -e ${block_configfs_path} ] && ocf_log warn "existing block without an active lun: ${block_configfs_path}"

                [ -e ${block_configfs_path} ] && return $OCF_ERR_GENERIC



Nick Fisk
Technical Support Engineer

System Professional Ltd
tel: 01825 830000
mob: 07711377522
fax: 01825 830001
mail: Nick.Fisk@xxxxxxxxxxxxx
web: www.sys-pro.co.uk

IT SUPPORT SERVICES | VIRTUALISATION | STORAGE | BACKUP AND DR | IT CONSULTING

Registered Office:
Wilderness Barns, Wilderness Lane, Hadlow Down, East Sussex, TN22 4HU
Registered in England and Wales.
Company Number: 04754200


Confidentiality: This e-mail and its attachments are intended for the above named only and may be confidential. If they have come to you in error you must take no action based on them, nor must you copy or show them to anyone; please reply to this e-mail and highlight the error.

Security Warning: Please note that this e-mail has been created in the knowledge that Internet e-mail is not a 100% secure communications medium. We advise that you understand and observe this lack of security when e-mailing us.

Viruses: Although we have taken steps to ensure that this e-mail and attachments are free from any virus, we advise that in keeping with good computing practice the recipient should ensure they are actually virus free. Any views expressed in this e-mail message are those of the individual and not necessarily those of the company or any of its subsidiaries.
-- 
Linux-cluster mailing list
Linux-cluster@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/linux-cluster

[Index of Archives]     [Corosync Cluster Engine]     [GFS]     [Linux Virtualization]     [Centos Virtualization]     [Centos]     [Linux RAID]     [Fedora Users]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Camping]

  Powered by Linux