COMSTAR setup with Sun Server X3-2L with 4x 400 GB Sun F40 Flash
Accelerator PCI-E and 1x Sun StorageTek 8 Gb FC PCIe HBA.

################################################################################
Configure the QLC driver to run in target mode to prepare the Sun Server X3-2L
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 the F40 Flash Accelerator Cards.
################################################################################
  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 two 8-way metadevice stripes.
   % cd scripts
   % ./03.stripes

  Verify metadevices have been created using the metastat(1M) utility.
  Metadevices d1 and d2 each contain 8 flash modules.
  % metastat

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

  % cd scripts
  % ./04.mirror_md

  Verify that metadevice mirror d10 has been created
  % metastat

################################################################################
Create soft partitions.
################################################################################
Create soft partitions of size 28GB from the mirrored devices
created in the previous step.

  % cd scripts
  % ./05.softparts

  Verify that 32 soft partitions 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


################################################################################
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 group for exporting COMSTAR luns on QLT port 0 and
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 a target group
  % stmfadm create-tg tg0

  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 tg0 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 Server X3-2L 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.
