If you’ve read my last Smart Zoning post on Cisco Smart Zoning you should have a good understanding of the how and why of Smart Zoning. Shortly after that post I being the process of converting two SAN Fabrics from traditional zoning to Smart Zoning. Cisco has an easy way to convert your traditional zones to a Smart Zone. The base requirement for doing this is what you have Smart Zoning enabled. It’s a simply process.
# conf t (config)# zone smart-zone enable vsan 100 Smart Zoning distribution initiated. Check zone status. (config)# zone convert smart-zone vsan 100 (config)# zoneset activate name ZoneSet_VSAN100 vsan 100
It’s a simply process, right? All this does it query the FCNS database and marks each Zone Member as either init, target, or both. That is all well and good, but you still have exactly the same number of zones. The whole point of Smart Zoning is to reduce the management complexity by having significantly less zones. If you would like to do that what you’ll need to do is manually modify each zone to combine them. That is a huge process. In the end it’s worth it, but we need an easier way.
I started to think of the best way to do it more programmatically. First we’d want to get a first of initiators in our fabric. You have a few options here, but for me the easiest way is to go right to the FCNS database.
switch# show fcns database vsan 1 VSAN 1: -------------------------------------------------------------------------- FCID TYPE PWWN (VENDOR) FC4-TYPE:FEATURE -------------------------------------------------------------------------- 0x030001 N 10:00:00:05:32:00:25:a3 (Cisco) ipfc 0x030101 NL 10:00:00:00:75:99:60:2c (Emulex) scsi-fcp:init 0x030200 N 10:00:00:49:c7:28:c7:01 (Emulex) scsi-fcp:init 0x030300 N 10:00:00:4a:c7:28:c7:01 scsi-fcp:init 0x030400 N 10:00:00:59:c7:28:c7:01 0xec0001 NL 21:00:00:20:35:a6:be:14 (Seagate) scsi-fcp:target 0xec0100 N 10:00:00:05:32:00:26:23 (Cisco) ipfc 0xec0200 N 10:00:00:5a:c7:28:c7:01
We can use the information gathered from the FCNS database to find all initiators. The easiest way to do this is “show fcns database |include init”. This will return all the know initiators. With this list we can pick a world-wide-name and look for all zones which contain this wwn entry. The easiest way to do this is “show zone member pwwn”. This will return a list of zone names which contain the entry, as shown below:
switch# show zone member pwwn 10:00:00:49:c7:28:c7:01 VSAN: 100 zone z_ServerA_SP_A0 zone z_ServerA_SP_B0 zone z_ServerA_FA_7g0 zone z_ServerA_FA_9g0
In the example above we can see that this initiator is contained in four separate zones. Ah, a great candidate for Smart Zoning. We can reduce the number of zones from 4 down to 1 very easily. First we need to get the target world-wide-names. We could show the zone members for each zone and make note of the target, or we can get clever with the command line.
switch# show zone member pwwn 10:00:00:49:c7:28:c7:01 |include zone |cut -d ' ' -f 4 | sed -r 's/(.*)/show zone name &/g' |vsh | include pwwn |exclude 10:00:00:49:c7:28:c7:01 pwwn 50:00:00:9c:35:a6:be:14 pwwn 50:00:00:9c:35:a6:be:16 pwwn 50:00:00:c8:35:a6:be:0a pwwn 50:00:00:c8:35:a6:be:01
At this point we have enough to make a zone. We have the initiator and all the targets. Our zone would be pretty simply:
zone name sz_ServerA VSAN 100 member pwwn 10:00:00:49:c7:28:c7:01 init member pwwn 50:00:00:9c:35:a6:be:14 target member pwwn 50:00:00:9c:35:a6:be:16 target member pwwn 50:00:00:c8:35:a6:be:0a target member pwwn 50:00:00:c8:35:a6:be:01 target
So now we have one zone, ready to be created to replace the legacy zones. This process works great, but it’s highly manually. Manually is all well and good, because this is your zoning right? You don’t want to mess it up and have hosts missing data it needs. But if you, like me, have 4000 zones to need to combine you might want to make this a bit easier. So, i wrote a script to do just that.
I have some tweaks to my environment, mainly a Regular Expression to parse the name of the server from the Zone. You’ll likely want to modify the regex to fit your environment. I also have SSH keys, so I can log in without typing my password. Other than that, this is actually pretty much just a replay of the steps I’ve outlined above. Here is a small sample of its output:
mgmt01 $ ./sz_mass_convert.pl 192.168.1.3 100 conf t zone name h_SERVERA VSAN 100 member pwwn 10:00:00:49:c7:28:c7:01 init member pwwn 50:00:00:9c:35:a6:be:14 target member pwwn 50:00:00:9c:35:a6:be:16 target member pwwn 50:00:00:c8:35:a6:be:0a target member pwwn 50:00:00:c8:35:a6:be:01 target exit
This goes on for every initiator we find in the FCNS database. Some things to note are this looks for initiators only, it does not take into account anything logged in as “both”. Also, check this! Don’t just trust the output, as it hasn’t been widely used yet. Automaton is great, but it’s important to double-check the results.
As you move forward with Smart Zoning, I think you’ll find this script very helpful.
[box type=”download”] sz_mass_convert[/box]