By default, PowerVC zone naming uses fixed template strings. Starting PowerVC 1.4.0, you could customize the zone name template that is used to create zone names, and some further enhancements were added in 1.4.1. This blog will describe how to create customized zone name templates.
Why would I want a customized zone name template?
If you are an administrator of a data center or a production environment, you might want to clearly identify which virtual machines are zoned to which storage, which fabrics have which virtual machines, or you might just want your zone names to be filterable based on VM host names or any custom prefix. In these cases, the default naming templates,
"%(prefix)s%(vm_name)s_%(initiator_wwpn)s'%(target_wwpn)s" for initiator-target, and
"%(prefix)s%(vm_name)s_%(initiator_wwpn)s" for initiator and initiator-vfc policies, won't give you the information you desire. Note: Changes to zone name template will be applicable to newer deploys.
For customizing zone name template, we have a dedicated powervc-config storage command as follows:
powervc-config storage fc-zone zone-name-template
For full details, display the help for the command:
powervc-config storage fc-zone zone-name-template -h
usage: powervc-config storage fc-zone zone-name-template [-h][-t TEMPLATE_STRING | -u][--restart]
Use this command to view or specify how zones are named on SAN fabrics when created through PowerVC. The following variables are available for the
template string and will be dynamically replaced by their respective values when the zone is created: prefix, vm_name, initiator_wwpn, target_wwpn,
storage_hostname, storage_display_name.
.............
.............
A zone name typically has a 64-character limit (both Brocade and Cisco). If the template causes the zone name to exceed 64 characters, zone name will be truncated by PowerVC.
The zone-name-template can be a combination of these keys: 'vm_name', 'storage_hostname', 'storage_display_name', 'intiatior_wwpn', 'target_wwpns', or your custom string. vm_name corresponds to virtual machine's host name.
For example, say you want zone name template to be a combination of the virtual machine name, storage name, initiator WWPNs, and target WWPNs. Assume you also want to truncate the VM's name to 5 characters, the storage host name to 4 characters, the initiator WWPN to 5 characters, and the target WWPN to 4 characters, then you would specify the zone-name-template as:
%(vm_name).5s_%(storage_hostname).4s_%(initiator_wwpn).5s_%(target_wwpn).4s
%(vm_name).5s means that the virtual machine hostname will be truncated to reflect the first 5 characters.
If the name has fewer than 5 characters, then the name is not truncated.
If you don't want any truncation for initiator_wwpns and target_wwpns, you can simply use:
%(vm_name).5s_%(storage_hostname).4s_%(initiator_wwpn)s_%(target_wwpn)s
Example:
For VM host name PowerVC_1234_abcd, with %(vm_name).5s, the zone name becomes Power (First 5 characters).
For VM host name Pow, with %(vm_name).5s, the zone name becomes Pow (All 3 characters).
To set our example template in PowerVC, run this command:
# powervc-config storage fc-zone zone-name-template -t "%(vm_name).5s_%(storage_hostname).4s_%(initiator_wwpn).5s_%(target_wwpn).4s" --restart
Configuration has been successfully set: zone-name-template = %(vm_name).5s_%(storage_hostname).4s_%(initiator_wwpn).5s_%(target_wwpn).4s
Restart of cinder services requested.
# cat /etc/cinder/fabrics.conf | grep zone_name_template
zone_name_template = %(vm_name).5s_%(storage_hostname).4s_%(initiator_wwpn).5s_%(target_wwpn).4s
Starting PowerVC 1.4.4, we have added left truncation to the existing
powervc-config zone-name-template
command by introducing a letter 'L' in prefixes. We now support left truncation for vm_name, initiator_wwpn, target_wwpn, storage_host_name, and storage_display_name.
Example-1: If zone_name_template is set to: [check in /etc/cinder/fabrics.conf file]
%(vm_name).5Ls_%(storage_hostname).4Ls_%(storage_display_name).3Ls_%(initiator_wwpn).5Ls_%(target_wwpn).4Ls
%(vm_name).5Ls indicates that the vm_name will be truncated from the left to reflect the first (len(vm_name) -5) characters.
%(initiator_wwpn).5Ls indicates that the initiator_wwpn will be truncated from left to reflect the first (len(initiator_wwpn) - 5) characters. If the name has fewer than 5 characters, then the name is not truncated.
%(target_wwpn).4Ls indicates that the target_wwpn will be truncated from left to reflect the first (len(target_wwpn) - 4) characters.
%(storage_hostname).4Ls indicates that the storage_hostname will be truncated from left to reflect the first (len(storage_hostname) -4) characters.
%(storage_display_name).3Ls indicates that the storage_display_name will be truncated from the left to reflect the first (len(storage_display_name) -3) characters.
Example-2:initiator_wwpn = "c0:50:76:07:a9:88:07:c5"
%(initiator_wwpn).5Ls = "807c5" ["c0507607a98" is truncated and should not be visible in zone-name]
To set the example template in PowerVC, run this command:
# # powervc-config storage fc-zone zone-name-template -t "%(vm_name).5Ls_%(storage_hostname).4Ls_%(storage_display_name).3Ls_%(initiator_wwpn).5Ls_%(target_wwpn).4Ls" --restart
Configuration has been successfully set: zone-name-template = %(vm_name).5Ls_%(storage_hostname).4Ls_%(storage_display_name).3Ls_%(initiator_wwpn).5Ls_%(target_wwpn).4Ls
Restart of cinder services requested.
# cat /etc/cinder/fabrics.conf | grep zone_name_template
zone_name_template = %(vm_name).5Ls_%(storage_hostname).4Ls_%(storage_display_name).3Ls_%(initiator_wwpn).5Ls_%(target_wwpn).4Ls
Let’s see the flexible SAN zone name in action. For this, our current test environment consists of the following components: 1 NovaLink managed host, 1 Brocade fabric, and 1 Hitachi storage device. All the examples below work for PowerVC 1.4.1 and above.
We are going to go through three different zoning policies namely: initiator, initiator-target, and initiator-vfc with three different templates.
1. Zoning policy: initiator
Current zone-name-template:
%(vm_name).5s_%(storage_hostname).4s_%(initiator_wwpn).5s_%(target_wwpn).4s
Let's deploy a VM with the name VM_INITIATOR_POLICY (Be sure to follow all the rules mentioned in Considerations for deploying captured or imported images).
Values passed to determine the zone name (internally):
'initiator': u'c050760867264554', //initiator_wwpn
'storage': 't164g1500', // Storage Host Name
'storage_disp': 'HDS_G1500', // Storage Display Name
'target': u'50060e800750b110', //target_wwpn
'host_name': u'VM_INITIATOR_-e59480a4-00000002' // VM host Name
When we log in to the switch, we see:
c387f14u40:FID128:admin> zoneshow | grep VM_IN
VM_IN_t164_c0507_EZ3P; VM_IN_t164_c0507_GYRP
zone: VM_IN_t164_c0507_EZ3P
zone: VM_IN_t164_c0507_GYRP
zone: VM_IN_t164_c0507_EZ3P
zone: VM_IN_t164_c0507_GYRP
So, we see:
VM_IN = VM Host Name was truncated to 5 characters.
t164 = Storage Host was truncated to 4 characters.
c0507 = Initiator wwpn was truncated to 4 characters.
EZ3P/GYRP = 4-character unique string is appended to maintain uniqueness since the zoning policy is Initiator and the initiators are truncated.
target_wwpn was suppressed because for Initiator Policy, each initiator will be paired with all the targets.
When is a 4-character unique string appended?
A string is appended in these cases:
i. If zoning-policy is initiator or initiator-vfc:
- You don't specify initiator_wwpn in the zone-name-template.
Example: "%(vm_name)s_%(storage_hostname)s_%(storage_display_name).8s"
- You specify initiator_wwpn in zone-name-template but want to truncate some part of initiator_wwpn.
Example: "%(vm_name)s_%(initiator_wwpn).3s_%(storage_display_name).8s"
ii. If zoning-policy is initiator-target:
- You don't specify either target_wwpn or initiator_wwpn in zone-name-template.
Example-1: "%(vm_name)s_%(storage_hostname)s_%(storage_display_name).8s_%(initiator_wwpn)s" // target_wwpn is not specified
Example-2: "%(storage_hostname)s_%(storage_display_name).8s_%(target_wwpn)s" // initiator_wwpn is not specified
- You specify both target_wwpn and initiator_wwpn in zone-name-template but want to truncate both or either of them.
Example: "%(prefix).4s_%(initiator_wwpn).9s_%(target_wwpn).3s" // initiator_wwpn and target_wwpn both are truncated.
iii. If you don't want to truncate intiator_wwpn or target_wwpn:
-
- Your VM's host name or storage display name is long.
Example: You specified template: "CENTER_1_%(initiator_wwpn)s_%(vm_name)s_%(storage_display_name)s"
- If you vm's host name is "TEST_VM_DATA_CENTER_1" and storage's display name is "STORWIZE_END_RACK",
in this case, PowerVC primarily will truncate vm_name and storage_display_name to fit into 64 character limit.
[Refer to the section "Zoning Policy: initiator-target" for an example.]
So, if you want to avoid the random characters being added, you should not truncate initiator wwpns or target wwpns.
2. Zoning Policy: initiator-target
I am going to re-register my fabric as initiator-target and change the zone-name-template to "DATA_CENTER_1_%(initiator_wwpn)s_%(vm_name)s_%(storage_display_name).6s" where we will add something as a prefix. A prefix can be easily prepended to our zone-name-template. Starting PowerVC 2.0.3 powervc-config zone-name-prefix command is deprecated.

Say we want to add the custom prefix DATA_CENTER_1 and truncate storage_display_name. Remember that the maximum length of zone name that PowerVC generates is 64 characters. We consider vm_name and storage_display_name as primary candidates to truncate in case the length exceeds 64 characters.
Our zone-name-template would be "DATA_CENTER_1_%(initiator_wwpn)s_%(vm_name)s_%(storage_display_name).6s
".
Here, we set the zone-name-template:
# powervc-config storage fc-zone zone-name-template -t "DATA_CENTER_1_%(initiator_wwpn)s_%(vm_name)s_%(storage_display_name).6s" --restart
Configuration has been successfully set, zone-name-template = DATA_CENTER_1_%(initiator_wwpn)s_%(vm_name)s_%(storage_display_name).6s
Restart of cinder services requested.
# cat /etc/cinder/fabrics.conf | grep zone_name_template
zone_name_template = DATA_CENTER_1_%(initiator_wwpn)s_%(vm_name)s_%(storage_display_name).6s
#
Let's deploy a VM: TEST_INITIATOR_TARGET_VM.

Let's see how our zone name turned out.
c387f14u40:FID128:admin> zoneshow | grep DATA_CENTER_1
DATA_CENTER_1_c050760867264558_TEST_INITIATO__HDS_G18JTA;
DATA_CENTER_1_c050760867264559_TEST_INITIATO__HDS_G10VKB
zone: DATA_CENTER_1_c050760867264558_TEST_INITIATO__HDS_G18JTA
zone: DATA_CENTER_1_c050760867264559_TEST_INITIATO__HDS_G10VKB
zone: DATA_CENTER_1_c050760867264558_TEST_INITIATO__HDS_G18JTA
zone: DATA_CENTER_1_c050760867264559_TEST_INITIATO__HDS_G10VKB
c387f14u40:FID128:admin>
You can see the following:
DATA_CENTER_1 : Our Custom Prefix
c050760867264558: Initiator wwpn
TEST_INITIATO_: Truncated VM host name // 64-character limit exceeded.
_HDS_G1: Truncated Storage Name (first 6 characters)
8JTA: Appended 4-character unique string because we did not specify target_wwpn in zone-name-template.
3. Zoning Policy: initiator-vfc
initiator-vfc policy was introduced in 1.4.1.[
Refer to Functional Enhancements Section]
I am going to re-register the fabric as initiator_vfc and this time, I will change the zone-name-template to "
%(storage_hostname)DATA_CENTER_2_%(target_wwpn)_%(initiator_wwpn)
"

Let's set the zone name template and deploy our VM.
# powervc-config storage fc-zone zone-name-template -t "%(storage_hostname)s_DATA_CENTER_2_%(initiator_wwpn)s" --restart
Configuration has been successfully set, zone-name-template = %(storage_hostname)s_DATA_CENTER_2_%(initiator_wwpn)s
Restart of cinder services requested.
# cat /etc/cinder/fabrics.conf | grep zone_name_template
zone_name_template = %(storage_hostname)s_DATA_CENTER_2_%(initiator_wwpn)s
#
Let's deploy our last VM: INITIATOR_VFC_VM:

We can see our zones on the actual fabric:
c387f14u40:FID128:admin> zoneshow | grep DATA_CENTER_2
t164g1500_DATA_CENTER_2_c05076086726456cc05076086726456d
zone: t164g1500_DATA_CENTER_2_c05076086726456cc05076086726456d
zone: t164g1500_DATA_CENTER_2_c05076086726456cc05076086726456d
c387f14u40:FID128:admin>
'c05076086726456cc05076086726456d' above can be interpreted as combination of 'c05076086726456c' and 'c05076086726456d' because initiator-vfc zoning puts both the active and migration initiators in a single zone.
Finally, let's see another simple case with zone-name-template: "pvc_%(vm_name)
" and zoning-policy: initiator-vfc.
VM: INDIA_DATA_CENTER

Let's check the zones at the switch:
c387f14u40:FID128:admin> zoneshow | grep pvc
pvc_INDIA_DATA_CE_07c0b615_0000000fGB7Y
zone: pvc_INDIA_DATA_CE_07c0b615_0000000fGB7Y
zone: pvc_INDIA_DATA_CE_07c0b615_0000000fGB7Y
c387f14u40:FID128:admin>
Thus, we see:
pvc: prefix in zone-name-template
INDIA_DATA_CE_07c0b615_0000000f: VM Host Name
GB7Y: 4-character unique string appended to maintain uniqueness.
Reset zone name template
If you want to set zone-name-template back to default(None) at any time, run this command:
# powervc-config storage fc-zone zone-name-template --unset --restart
Configuration has been successfully set, zone-name-template =
Restart of cinder services requested.
# cat /etc/cinder/fabrics.conf | grep zone_name_template
zone_name_template =
In a nutshell, you can customize zone-name-template based on what is needed for your environment or production systems. You can learn more about PowerVC Zoning and zoning policies here:
PowerVC Zoning blog.
If you have any questions, feel free to add them below. We’d love to hear from you! And don’t forget to follow us on
Facebook,
LinkedIn, and
Twitter.
Blog Authors
Abhinav Shrivastava
Maria Varghese
#Storage