COMSTAR setup with Sun Fire x4270 M2 with 2x 2TB SAS drives, 2x 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.
  % update_drv -d -i '"pciex1077,2532"' qlc
  % cp /etc/driver_aliases /etc/driver_aliases.orig
  % 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 80  Flash Modules (assumes 1 F5100 Flash Storage 
Array 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 used to create 2 metadb's per controller on a
  slice of 2 fmods.

   % cd scripts
   % ./02.metadb

  Create 4 20-way metadevice stripes across the flash modules on the flash array.
   % cd scripts
   % ./03.stripes

  Verify metadevices have been created using the metastat(1M) utility.
  % metastat

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

  % cd scripts
  % ./04.mirror_md

  Verify that 2 metadevice mirrors d10 - d11 have been created
  % metastat

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

  % cd scripts
  % ./05.softparts

  Verify that 32 soft parititions d101 - d132  have been created.
  % metastat

################################################################################
Create the data luns.
################################################################################
Create the 32 data luns using the SCSI target mode framework command.

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

  Example, 
  % ./06.create-lu 21


################################################################################
Create the target group for exporting COMSTAR luns. Create 2 target groups
per QLT HBA.  Then add in 1 view per LUN which to be exported as follows:

1. 28 luns exported to the database server host on target group 0.
2. 4 luns exported to the application server host on target group 1.
################################################################################

  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 - should report 2 port numbers
  % stmfadm list-target
  Target: wwn.21000024FF322XX1
  Target: wwn.21000024FF322XX2

  Assign QLT ports to the target groups displayed above
  % stmfadm add-tg-member -g tg0 wwn.21000024FF322XX1
  % stmfadm add-tg-member -g tg1 wwn.21000024FF322XX2

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

  Re-enable stmf service
  % svcadm enable stmf

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

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

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

################################################################################
Label luns on the database and application hosts.
################################################################################
