
florian.haas at linbit
Jul 1, 2009, 1:49 AM
Post #1 of 1
(249 views)
Permalink
|
|
[PATCH 2 of 4] RA: iSCSILogicalUnit: add support for SCSI ID, SCSI SN, Vendor ID, and Product ID
|
|
# HG changeset patch # User Florian Haas <florian.haas[at]linbit.com> # Date 1246437815 -7200 # Node ID bca917628205b84ae074794766039c57441b39e6 # Parent c1348677a740ff49129062e95496bdc93fd48693 RA: iSCSILogicalUnit: add support for SCSI ID, SCSI SN, Vendor ID, and Product ID. It seems nice to be able to set these in an implementation-independent way. These VPD attributes could already be set previously by using the "params" instance attribute, but that approach required observing that, for example, the SCSI ID is named "ScsiId" in IET while it's "scsi_id" in tgt. Now, you can just set "scsi_id" and the RA will translate to the appropriate target parameter, as per the implementation. Being able to set the SCSI ID is specifically helpful as some iSCSI initiator implementations rely on consistent SCSI IDs for smooth target failover. diff -r c1348677a740 -r bca917628205 resources/OCF/iSCSILogicalUnit --- a/resources/OCF/iSCSILogicalUnit Wed Jul 01 10:43:35 2009 +0200 +++ b/resources/OCF/iSCSILogicalUnit Wed Jul 01 10:43:35 2009 +0200 @@ -92,6 +92,38 @@ <content type="string" /> </parameter> +<parameter name="scsi_id" required="0" unique="0"> +<longdesc lang="en"> +The SCSI ID to be configured for this Logical Unit. +</longdesc> +<shortdesc lang="en">SCSI ID</shortdesc> +<content type="string" /> +</parameter> + +<parameter name="scsi_sn" required="0" unique="0"> +<longdesc lang="en"> +The SCSI serial number to be configured for this Logical Unit. +</longdesc> +<shortdesc lang="en">SCSI serial number</shortdesc> +<content type="string" /> +</parameter> + +<parameter name="vendor_id" required="0" unique="0"> +<longdesc lang="en"> +The SCSI vendor ID to be configured for this Logical Unit. +</longdesc> +<shortdesc lang="en">SCSI vendor ID</shortdesc> +<content type="string" /> +</parameter> + +<parameter name="product_id" required="0" unique="0"> +<longdesc lang="en"> +The SCSI product ID to be configured for this Logical Unit. +</longdesc> +<shortdesc lang="en">SCSI product ID</shortdesc> +<content type="string" /> +</parameter> + <parameter name="params" required="0" unique="0"> <longdesc lang="en"> LU parameters. A space-separated list of "name=value" pairs which @@ -162,7 +194,14 @@ case $OCF_RESKEY_implementation in iet) # in IET, we have to set LU parameters on creation - params="Path=${OCF_RESKEY_path} ${OCF_RESKEY_params}" + params="Path=${OCF_RESKEY_path}" + if [ -n "${OCF_RESKEY_scsi_id}" ]; then + params="${params} ScsiId=${OCF_RESKEY_scsi_id}" + fi + if [ -n "${OCF_RESKEY_scsi_sn}" ]; then + params="${params} ScsiSN=${OCF_RESKEY_scsi_sn}" + fi + params="${params} ${OCF_RESKEY_params}" do_cmd ietadm --op new \ --tid=${OCF_RESKEY_tid} \ --lun=${OCF_RESKEY_lun} \ @@ -171,7 +210,16 @@ tgt) # tgt requires that we create the LU first, then set LU # parameters - params="${OCF_RESKEY_params}" + params="" + local var + local envar + for var in scsi_id scsi_sn vendor_id product_id; do + envar="OCF_RESKEY_${var}" + if [ -n "${!envar}" ]; then + params="${params} ${var}=${!envar}" + fi + done + params="${params} ${OCF_RESKEY_params}" do_cmd tgtadm --lld iscsi --op new --mode logicalunit \ --tid=${OCF_RESKEY_tid} \ --lun=${OCF_RESKEY_lun} \ @@ -329,6 +377,25 @@ ;; esac + # Do we have any configuration parameters that the current + # implementation does not support? + case $OCF_RESKEY_implementation in + iet) + # IET does not support setting the vendor and product ID + # (it always uses "IET" and "VIRTUAL-DISK") + local var + local envar + for var in vendor_id product_id; do + envar=OCF_RESKEY_${var} + if [ -n "${!envar}" ]; then + ocf_log warn "Configuration parameter \"${var}\"" \ + "is not supported by the iSCSI implementation" \ + "and will be ignored." + fi + done + ;; + esac + return $OCF_SUCCESS } _______________________________________________________ Linux-HA-Dev: Linux-HA-Dev[at]lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev Home Page: http://linux-ha.org/
|