Thursday, 22 November 2012

COMSTAR target groups and host groups

So, after using the storage server I built between multiple servers it soon became apparent that I needed to limit the LUN's each client system could see via iSCSI or Fibre. It turns out that its just a small step onwards from the basic COMSTAR tutorials you see around.

First you need to figure out what groupings you have, if you're running a large company, you might want to split your LUN's between development and production (although you should really be making that split at the storage server level if you really want to avoid resource conflicts between development and production!), you may want to split purely by client machine, or maybe some mixture of both.

Target Groups


These allow the broadest split, for example, at a really granular level, I've split my target groups into two categories, based on whether I expect them to be accessed via iSCSI or via Fibre.

 # stmfadm create-tg san  
 # stmfadm add-tg-member -g san wwn.10000000c95287ca  
 # stmfadm add-tg-member -g san wwn.10000000c95287cb  
 # stmfadm create-tg iscsi  
 # itadm create-target  
 Target iqn.2010-09.org.openindiana:02:92b0fb10-bc5e-6292-9d14-84ea8bad9650 successfully created  
 # stmfadm add-tg-member -g iscsi iqn.2010-09.org.openindiana:02:92b0fb10-bc5e-6292-9d14-84ea8bad9650  
 # svcadm enable -r svc:/network/iscsi/target:default  

Host Groups


These allow finer control over what hosts can see what. I take this literally, and define a host group per physical client. However if you need to share LUN's between systems - say for a cluster, then you could specifically set that up here.

 # stmfadm create-hg imac-1  
 # stmfadm create-hg aix-1  

Since these are iSCSI hosts, we add an iqn.

 # stmfadm add-hg-member -g imac-1 iqn.<client>  
 # stmfadm add-hg-member -g aix-1 iqn.<client>  
 # stmfadm create-hg rx220-1  
 # stmfadm create-hg t2k-1  

Since these are fibre hosts, we add a WWN.

 # stmfadm add-hg-member -g rx220-1 wwn.10000000c9711403  
 # stmfadm add-hg-member -g rx220-1 wwn.10000000c9711404  
 # stmfadm add-hg-member -g t2k-1 wwn.10000000c97e366c  
 # stmfadm add-hg-member -g t2k-1 wwn.10000000c97e366d  

Assigning LU's


Now all that remains is to assign your LU's to the correct host and target groups. For example, you may have done something similar to the following to create 8 LU's:-

 # zfs create storagepool/LU_vols  
 > for each in 00 01 02 03 04 05 06 07  
 > do  
 > zfs create -V 100GB storagepool/LU_vols/disk$each  
 > stmfadm create-lu /dev/zvol/rdsk/storagepool/LU_vols/disk$each  
 > done  

Heres where the extra step happens:-

 # stmfadm add-view -t iscsi -h imac-1 <LU_disk00>  
 # stmfadm add-view -t iscsi -h imac-1 <LU_disk01>  
 # stmfadm add-view -t iscsi -h smitty-1 <LU_disk02>  
 # stmfadm add-view -t iscsi -h smitty-1 <LU_disk03>  
 # stmfadm add-view -t san -h t2k1-1 <LU_disk04>  
 # stmfadm add-view -t san -h t2k1-1 <LU_disk05>  
 # stmfadm add-view -t san -h rx220-1 <LU_disk06>  
 # stmfadm add-view -t san -h rx220-1 <LU_disk07>  

No comments: