1 #
   2 # CDDL HEADER START
   3 #
   4 # The contents of this file are subject to the terms of the
   5 # Common Development and Distribution License (the "License").
   6 # You may not use this file except in compliance with the License.
   7 #
   8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9 # or http://www.opensolaris.org/os/licensing.
  10 # See the License for the specific language governing permissions
  11 # and limitations under the License.
  12 #
  13 # When distributing Covered Code, include this CDDL HEADER in each
  14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15 # If applicable, add the following below this CDDL HEADER, with the
  16 # fields enclosed by brackets "[]" replaced with your own identifying
  17 # information: Portions Copyright [yyyy] [name of copyright owner]
  18 #
  19 # CDDL HEADER END
  20 #
  21 
  22 #
  23 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24 # Use is subject to license terms.
  25 #
  26 
  27 #
  28 # A test purpose file to test data visibility related with
  29 # iscsi target port provider
  30 #
  31 
  32 # __stc_assertion_start
  33 #
  34 # ID: iscsi_visible_007
  35 #
  36 # DESCRIPTION:
  37 #       initiator keep update the lun information through the target when
  38 #       the luns are changed on the target side.
  39 #
  40 # STRATEGY:
  41 #       Setup:
  42 #               1. Configure discovery address with <target side ip address>
  43 #                  for initiator using iscsiadm add discovery-address
  44 #
  45 #               2. itadm create a target portal group with proper ip address
  46 #
  47 #               3. itadm create 1 target with the created target portal group
  48 #
  49 #               4. Create and online 3 luns and bound it to the target in stmf
  50 #                  frame.
  51 #
  52 #               5. Enable "SentTarget" discovery method on initiator using
  53 #                  iscsiadm modify discovery -t enable
  54 #
  55 #               6. Check that the initiator can see the three new created
  56 #                  luns with online status
  57 #
  58 #       Test:
  59 #               1. Delete lun 1 in stmf frame
  60 #
  61 #               2. Offline lun 2 in stmf frame
  62 #
  63 #               3. Verify that the initiator have lun 2 and lun 3 under the target
  64 #                  lun list
  65 #       Cleanup:
  66 #               1. Delete the target luns, target, target portal group
  67 #
  68 #               2. Disable the discovery method on initiator and remove the
  69 #                  discovery address
  70 #
  71 #       STRATEGY_NOTES:
  72 #
  73 # TESTABILITY: explicit
  74 #
  75 # AUTHOR: zheng.he@sun.com
  76 #
  77 # REVIEWERS:
  78 #
  79 # ASSERTION_SOURCE:
  80 #
  81 # TEST_AUTOMATION_LEVEL: automated
  82 #
  83 # STATUS: IN_PROGRESS
  84 #
  85 # COMMENTS:
  86 #
  87 # __stc_assertion_end
  88 #
  89 function tp_iscsi_visible_007
  90 {
  91         cti_pass
  92 
  93         tc_id="tp_iscsi_visible_007"
  94 
  95         tc_desc="initiator keep update the lun information through the target"
  96         tc_desc="${tc_desc} when the luns are changed on the target side."
  97         print_test_case $tc_id - $tc_desc
  98 
  99         # Set discover address
 100         typeset portal_list
 101         set -A portal_list $(get_portal_list ${ISCSI_THOST})
 102 
 103         iscsiadm_add POS ${ISCSI_IHOST} discovery-address \
 104                  "${portal_list[0]}"
 105 
 106         # Create target and target protal group
 107         itadm_create POS tpg 1 "${portal_list[0]}"
 108         itadm_create POS target -n ${IQN_TARGET}.${TARGET[0]} -t 1
 109 
 110         #Create lu      
 111         build_fs zdsk
 112         fs_zfs_create -V 1g $ZP/${VOL[0]}    
 113         fs_zfs_create -V 1g $ZP/${VOL[1]}    
 114         fs_zfs_create -V 1g $ZP/${VOL[2]}    
 115         sbdadm_create_lu POS -s 1024k $DEV_ZVOL/$ZP/${VOL[0]}
 116         sbdadm_create_lu POS -s 1024k $DEV_ZVOL/$ZP/${VOL[1]}
 117         sbdadm_create_lu POS -s 1024k $DEV_ZVOL/$ZP/${VOL[2]}
 118 
 119         typeset guid1 guid2 guid3
 120 
 121         eval guid1="\$LU_${VOL[0]}_GUID"
 122         eval guid2="\$LU_${VOL[1]}_GUID"
 123         eval guid3="\$LU_${VOL[2]}_GUID"
 124 
 125         # Add view
 126         stmfadm_add POS view "${guid1}"
 127         stmfadm_add POS view "${guid2}"
 128         stmfadm_add POS view "${guid3}"
 129 
 130         # Enable sendTargets discovery method
 131         iscsiadm_modify POS ${ISCSI_IHOST} discovery -t enable
 132         # Verify the lun on initiator host
 133         iscsiadm_verify ${ISCSI_IHOST} lun
 134         
 135         sbdadm_delete_lu POS "${guid1}"
 136         stmfadm_offline POS lu "${guid3}"
 137         
 138         # Enable sendTargets discovery method to update information
 139         iscsiadm_modify POS ${ISCSI_IHOST} discovery -t enable
 140         # Verify the lun on initiator host
 141         iscsiadm_verify ${ISCSI_IHOST} lun
 142 
 143         tp_cleanup
 144         clean_fs zdsk
 145         initiator_cleanup "${ISCSI_IHOST}"
 146 
 147 }
 148