COMSTAR setup with Sun Fire x4270 M2 with 12 SAS drives, 4x Sun Storage
6 Gb SAS HBA, 1x Sun StorageTek 8 Gb FC PCIe HBA, and 2x Sun Storage F5100
Flash Arrays.

################################################################################
Configure the QLC driver to run in target mode to prepare the Sun Fire x4270 M2
to be a COMSTAR server.
################################################################################
  Enable stmf services
  % svcadm enable stmf

  Verify QLC device contains pciex1077,2532
  % echo ::devbindings -q qlc | mdb -k
  ffffff02d280f580 pciex1077,2532, instance #0 (driver name: qlc)
  ffffff02d280f2d0 pciex1077,2532, instance #1 (driver name: qlc)

  Notify the system to replace the qlc driver with the the qlt (Qlogic
  Target driver) for this device.
  % cp /etc/driver_aliases /etc/driver_aliases.orig
  % update_drv -d -i '"pciex1077,2532"' qlc
  % nawk '!($1 == "qlc" && $2 == "\"pciex1077,2532\"")' /etc/driver_aliases > /etc/driver_aliases.new
  % cp /etc/driver_aliases.new /etc/driver_aliases
  % update_drv -a -i '"pciex1077,2532"' qlt
  devfsadm: driver failed to attach: qlt
  Warning: Driver (qlt) successfully added to system but failed to attach

  Reboot the system to complete qlt driver install
  % reboot

  After reboot, check that qlc devices are now in target mode
  where the qlt driver is loaded:

  %  echo "::devbindings -q qlt" | mdb -k
  ffffff024eb84580 pciex1077,2532, instance #0 (driver name: qlt)
  ffffff024eb842d0 pciex1077,2532, instance #1 (driver name: qlt)

 % fcinfo hba-port | egrep 'HBA|Mode|Driver Name'
  HBA Port WWN: 21000024ff303b22
        Port Mode: Target
        Model: QLE2562
        Driver Name: COMSTAR QLT
  HBA Port WWN: 21000024ff303b23
        Port Mode: Target
        Model: QLE2562
        Driver Name: COMSTAR QLT

Note: the WWN numbers listed by fcinfo will be different
than those listed above.

################################################################################
Discover all Flash Modules and run format to prepare for creating Metadevices.
################################################################################

Use the following script to report all Flash Modules: 
    % cd scripts
    % ./00.findfmods

Use the following script to format all Flash Modules: 
    % cd scripts
    % ./01.fdisk_format 

################################################################################
Create SVM stripes across all 160 Flash Modules (assumes 2 F5100 Flash Storage 
Arrays each with 80 flash modules and labels applied in the previous step).
################################################################################
  Create metadevice state database replicas on one of the internal disks.
  The following script can be used to add 2 metadb's per controller on
  slice 1 of 2 fmods.

   % cd scripts
   % ./02.metadb

  Create four 80-way metadevice stripes across the flash modules on each
  flash array.
   % cd scripts
   % ./03.stripes

  Verify metadevices have been created using the metastat(1M) utility.
  Metadevices d0 - d3 contain 80 flash modules from one of the 2 arrays
  and metadevices d4 - d7 contain 80 flash modules from the other array
  % metastat

################################################################################
Create mirrored devices.
################################################################################
Create 2-way mirrors using metadevices created in the previous step
as submirrors.

  % cd scripts
  % ./04.mirror_md

  Verify that 4 metadevice mirrors d10 - d13 have been created
  % metastat

################################################################################
Create soft partitions.
################################################################################
Create 64 soft partitions of size 28GB from the four 2-way mirrors 
created in the previous step.

  % cd scripts
  % ./05.softparts

  Verify that 64 soft partitions d101 - d164  have been created.
  % metastat

################################################################################
Create the data luns.
################################################################################
Create the 64 data luns usig the SCSI target mode framework command.

  % cd scripts
  % ./06.create-lu <unique-2-digit-number>

  Example, 
  % ./06.create-lu 21


################################################################################
Enable Solaris I/O multipathing feature on the database hosts
################################################################################

  On the database host, enter:
  % stmsboot -e

  Wait for command to return and prompt for a reconfiguration reboot.
  Type in yes and reboot

################################################################################
Create the target groups for exporting COMSTAR luns. Create 1 target group 
per QLT port.  Then add in 1 view per LUN which to be exported to the
database  host.
################################################################################

  To create/destroy target groups, stmf (scsi target mode framework) must
  be disabled if enabled:
  % svcadm disable stmf

  Create target groups
  % stmfadm create-tg tg0
  % stmfadm create-tg tg1

  Verify target groups created:
  % stmfadm list-tg

  Display target WWN ports
  % stmfadm list-target
  Target: wwn.2101001B32B20xxx
  Target: wwn.2100001B32920yyy

  Assign 1 QLT port per target group
  % stmfadm add-tg-member -g tg0 wwn.2101001B32B20xxx
  % stmfadm add-tg-member -g tg1 wwn.2101001B32B20xxx
  % stmfadm add-tg-member -g tg0 wwn.2100001B32920yyy
  % stmfadm add-tg-member -g tg1 wwn.2100001B32920yyy

  Verify WWN ports added to target groups
  % stmfadm list-tg -v

  Re-enable stmf service
  % svcadm enable stmf

  Add the views for the all 64 luns.
  % cd scripts
  % ./07.add_views

################################################################################
Initiate device discovery on the database host for DATA devices
################################################################################
  Verify that the luns are now visible on the database host using
  the fcinfo(1M) utility after making physical cable connections
  between the HBA on the Sun Fire X4270 M2 and the HBA on the
  database host.

  % fcinfo hba-port | grep "^HBA" | awk '{print $4}'|while read ln
  > do
  >     echo Local Port WWN: $ln
  >     fcinfo remote-port -p $ln -s
  > done

################################################################################
Label luns on the database host.
################################################################################

  On the database host, use the format(1M) utility to label
  the new luns.

  % cd scripts 
  % ls -1 /dev/rdsk/c0t600144F0A3770E00000000000D*s2 > LUNS
  % 08.label
