{"id":97,"date":"2011-09-05T07:10:29","date_gmt":"2011-09-05T06:10:29","guid":{"rendered":"http:\/\/www.simweb.ch\/blog\/?p=97"},"modified":"2011-09-19T07:23:27","modified_gmt":"2011-09-19T06:23:27","slug":"nexenta-illumos-as-fc-target-lun-mapping-3","status":"publish","type":"post","link":"https:\/\/www.simweb.ch\/blog\/2011\/09\/nexenta-illumos-as-fc-target-lun-mapping-3\/","title":{"rendered":"Nexenta \/ illumos as FC target: LUN mapping (3)"},"content":{"rendered":"<p>While you can also do quite some LUN mapping on the level of an FC switch I'd like to write here about what there are for possibilities on the level of the <del>OpenSolaris<\/del> \/ illumos STMF:<\/p>\n<p><a title=\"Nexenta \/ illumos as FC target (2)\" href=\"https:\/\/www.simweb.ch\/blog\/2011\/09\/nexenta-illumos-as-fc-target-2\/\">Last time I simply added a view to a LUN for everybody<\/a> which isn't a good idea if you are not using a cluster-aware filesystem (i.e. GFS, OCFS, or NTFS as a cluster-shared volume). Now we need to restrict the access to a LUN: For this STMF allows us to create host groups (hg) and target groups (tg).<\/p>\n<p>Last time I have mapped a LUN to everyone, now I want to restrict the access to this LUN to a node called 'akebono' so let's create a host group for all the HBAs installed in this akebono:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\"># stmfadm create-hg akebono\r\n# stmfadm list-hg\r\nHost Group: akebono<\/pre>\n<p>In the FC aread each HBA card has a unique WWNN (world wide node name) an since there are HBAs with more than one port, each port has its\u00a0 WWPN (worldwide port name), this is a 64-bit value like the MAC address that every network controller has. stmfadm allows to add different types of names to a host or target group it IQNs (iSCSI qualified name) or WWNs (worldwide names are also used in SAS). We have to know the WWPN from the initiating HBAs. There are several ways to get the WWPNs (and possibly others):<\/p>\n<ul>\n<li>Use vendor-provided tools for each platform (in this case this might be the Qlogic SANsurfer CLI)<\/li>\n<li>(Linux\/BSD\/Unix) Lookup dmesg when the HBA driver gets loaded<\/li>\n<li>Sometimes it's written on a lable on the HBA<\/li>\n<\/ul>\n<p>But if you have a small FC environment, then you can cheat a little:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\"># stmfadm list-target -v\r\nTarget: wwn.50060B0000655664\r\n    Operational Status: Online\r\n    Provider Name     : qlt\r\n    Alias             : qlt3,0\r\n    Protocol          : Fibre Channel\r\n    Sessions          : 1\r\n        Initiator: <strong>wwn.210000E08B9BE2DF<\/strong>\r\n            Alias: -\r\n            Logged in since: Sat Sep  3 02:15:56 2011\r\nTarget: wwn.2101001B323FE743\r\n    Operational Status: Online\r\n    Provider Name     : qlt\r\n    Alias             : qlt2,0\r\n    Protocol          : Fibre Channel\r\n    Sessions          : 0\r\nTarget: wwn.2100001B321FE743\r\n    Operational Status: Online\r\n    Provider Name     : qlt\r\n    Alias             : qlt1,0\r\n    Protocol          : Fibre Channel\r\n    Sessions          : 1\r\n        Initiator: <strong>wwn.210000E08B9BF0E1<\/strong>\r\n            Alias: -\r\n            Logged in since: Sat Sep  3 02:15:56 2011\r\nTarget: wwn.50060B000065566E\r\n    Operational Status: Online\r\n    Provider Name     : qlt\r\n    Alias             : qlt0,0\r\n    Protocol          : Fibre Channel\r\n    Sessions          : 1\r\n        Initiator: wwn.210000E08B9BF0E1\r\n            Alias: -\r\n            Logged in since: Sat Sep  3 02:15:56 2011<\/pre>\n<p>The Nexenta box has 4 HBAs (3 Host Bus Adapters are connected, 2 to the same switch), so what we can now see are the WWNs of the targets and those of the (yet) single initiating node. Now we can add them to the host group\u00a0 - don't forget to have ww.&lt;yourWWPN&gt; because that's how\u00a0 STMF distinguishes between iSCSI IQNs, FC &amp; SAS WWNs and EUI's (Extended Unique Identifier):<\/p>\n<pre># stmfadm add-hg-member -g akebono wwn.210000E08B9BF0E1\r\n# stmfadm add-hg-member -g akebono wwn.210000E08B9BE2DF\r\n# stmfadm list-hg -v\r\nHost Group: akebono\r\n        Member: wwn.210000E08B9BF0E1\r\n        Member: wwn.210000E08B9BE2DF<\/pre>\n<p>Now we can delete our mapped LUN and re-map it properly so only HBAs in the host group akebono will see this LUN and be able to mount it:<\/p>\n<pre># stmfadm list-view -l 600144f098680b0000004e632dc60004\r\nView Entry: 0\r\n    Host group   : All\r\n    Target group : All\r\n    LUN          : 2\r\n# stmfadm remove-view -a -l 600144f098680b0000004e632dc60004\r\n# stmfadm list-view -l 600144f098680b0000004e632dc60004\r\nstmfadm: 600144f098680b0000004e632dc60004: no views found\r\n\r\n# stmfadm add-view -h akebono 600144f098680b0000004e632dc60004\r\n# stmfadm list-view -l 600144f098680b0000004e632dc60004\r\nView Entry: 0\r\n    Host group   : akebono\r\n    Target group : All\r\n    LUN          : 2<\/pre>\n<p>Voil\u00e0\u00a0 - well that's it: If you want to further restrict a node to utilize only let's say 2 out of 4 HBAs you can also create target groups too - currently akebono will be able to connect to this LUN over every reachable target path (be it FC or every other target, i.e. iSCSI). There is also a possibility to group all FC ports together, but be aware that in order to add a any target\u00a0 to a target group, you will have to offline it for a short period (this is now problem if you have fully working multipathing):<\/p>\n<pre># stmfadm create-tg fc-ports\r\n# stmfadm add-tg-member -g fc-ports wwn.50060B000065566E\r\nstmfadm: STMF target must be offline\r\n\r\n# stmfadm offline-target  wwn.50060B000065566E\r\n# stmfadm add-tg-member -g fc-ports wwn.50060B000065566E\r\n\r\n# stmfadm online-target wwn.50060B000065566E<\/pre>\n<p>This offline-online procedure seems to be mandatory for every target added to a target group. Later on you can\u00a0 (if you want) add a view to a LUN by also adding '-t &lt;targetGroupName&gt;' including the host group like before. - It might also be\u00a0 good thing if you want to manually balance the load on all of your target-mode HBAs.<\/p>\n<p>Next up: Setting up multipathing on Linux (Debian and Scientific Linux) and Windows (2008 R2).<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\"><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>While you can also do quite some LUN mapping on the level of an FC switch I&#8217;d like to write here about what there are for possibilities on the level of the OpenSolaris \/ illumos STMF: Last time I simply added a view to a LUN for everybody which isn&#8217;t a good idea if you &#8230; <a class=\"moretag\" href=\"https:\/\/www.simweb.ch\/blog\/2011\/09\/nexenta-illumos-as-fc-target-lun-mapping-3\/\">more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[1],"tags":[13,14,15],"class_list":["post-97","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-comstar","tag-fc","tag-nexenta"],"_links":{"self":[{"href":"https:\/\/www.simweb.ch\/blog\/wp-json\/wp\/v2\/posts\/97","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.simweb.ch\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.simweb.ch\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.simweb.ch\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.simweb.ch\/blog\/wp-json\/wp\/v2\/comments?post=97"}],"version-history":[{"count":0,"href":"https:\/\/www.simweb.ch\/blog\/wp-json\/wp\/v2\/posts\/97\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.simweb.ch\/blog\/wp-json\/wp\/v2\/media?parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.simweb.ch\/blog\/wp-json\/wp\/v2\/categories?post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.simweb.ch\/blog\/wp-json\/wp\/v2\/tags?post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}