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 functionality of backing storage
  29 #
  30 
  31 # __stc_assertion_start
  32 #
  33 # ID: iscsi_fs_007
  34 #
  35 # DESCRIPTION:
  36 #       Each protal is belonged to an individual target portal group,
  37 #       Running I/O data validation on initiator host
  38 #
  39 # STRATEGY:
  40 #       Setup:
  41 #               MPXIO is enable on initiator host
  42 #               zvol LUs (specified by VOL_MAX variable in configuration) are
  43 #                   created in iSCSI target host 
  44 #               Map all the LUs can be accessed by all the target and host groups
  45 #                   by stmfadm add-view option
  46 #               Create target portal groups with one portal per portal group
  47 #               Create one target node with all the portal groups supported
  48 #               Modify initiator target-param to allow all the initiator portals
  49 #                   to create one session individually to support mutlti-pathing 
  50 #                   with each target node
  51 #               Setup initiator node to enable "SendTarget" method
  52 #               Setup SendTarget with discovery address on initiator host
  53 #       Test:
  54 #               Start diskomizer on the initiator host
  55 #               Running I/O for 5 minutes
  56 #                       
  57 #       Cleanup:
  58 #               Stop the diskomizer
  59 #               Delete the target portal group
  60 #               Delete the target node
  61 #               Delete the configuration information in initiator and target
  62 #
  63 #       STRATEGY_NOTES:
  64 #
  65 # TESTABILITY: explicit
  66 #
  67 # AUTHOR: john.gu@sun.com
  68 #
  69 # REVIEWERS:
  70 #
  71 # ASSERTION_SOURCE:
  72 #
  73 # TEST_AUTOMATION_LEVEL: automated
  74 #
  75 # STATUS: IN_PROGRESS
  76 #
  77 # COMMENTS:
  78 #
  79 # __stc_assertion_end
  80 #
  81 function iscsi_fs_007
  82 {
  83         cti_pass
  84 
  85         tc_id="iscsi_fs_007"
  86         tc_desc="verify I/O data validation on one portal of one target portal group"
  87         print_test_case $tc_id - $tc_desc
  88 
  89         msgfile_mark $ISCSI_IHOST START $tc_id
  90         msgfile_mark $ISCSI_THOST START $tc_id
  91 
  92         stmsboot_enable_mpxio $ISCSI_IHOST
  93 
  94         build_fs zfs
  95 
  96         typeset vol_num=0
  97         while [ $vol_num -lt $VOL_MAX ]
  98         do
  99                 typeset vol_id=`/usr/bin/printf "%03s" $vol_num`
 100                 typeset vol_name=vol${vol_id}
 101 
 102                 touch $MP/$vol_name
 103                 sbdadm_create_lu POS -s ${VOL_SIZE} $MP/$vol_name
 104                 (( vol_num+=1 ))
 105         done
 106 
 107         build_full_mapping
 108 
 109         build_tpgt_1portal $ISCSI_THOST
 110 
 111         # NEX-3307 initiator code can panic with 1 target
 112         # tagged with multiple tpg.  Keep 1-1 
 113         #itadm_create POS target -t `get_tpgt_list|nawk -F',' '{print $1}'`
 114 
 115         typeset tpg_list=$(get_tpgt_list)
 116         itadm_create POS target -t ${tpg_list}
 117 
 118         iscsiadm_modify POS $ISCSI_IHOST discovery -t disable
 119         iscsiadm_add POS $ISCSI_IHOST discovery-address $ISCSI_THOST
 120         iscsiadm_modify POS $ISCSI_IHOST discovery -t enable
 121 
 122         start_disko $ISCSI_IHOST
 123 
 124         sleep $FS_SECONDS
 125 
 126         stop_disko $ISCSI_IHOST
 127         verify_disko $ISCSI_IHOST  
 128         ret=$?
 129         echo Done verify_disko
 130 
 131         msgfile_mark $ISCSI_IHOST STOP $tc_id
 132         msgfile_extract $ISCSI_IHOST $tc_id
 133         msgfile_mark $ISCSI_THOST STOP $tc_id
 134         msgfile_extract $ISCSI_THOST $tc_id
 135 
 136         host_reboot $ISCSI_IHOST
 137         tp_cleanup
 138         clean_fs zfs
 139         initiator_cleanup $ISCSI_IHOST
 140         [[ $ret -eq 0 ]] && cti_pass "tp_iscsi_fs_007: PASS"
 141 }
 142