Mar 05 2013

# Horizon View Multi-VLAN Explained

I am happy to finally be able to scratch this item from my list of missing View features.

• Support for Multi-VLAN

In Horizon View 5.2 it is possible to configure an automated pool to use multiple VLANS or network labels. Administrators can assign multiple network labels to a linked-clone pool or an automated pool that contains full virtual machines.

Going back to the previous releases of View and understanding the problem.

When creating pools, each desktop inherits the network label of its parent’s template/snapshot. This network label specifies a portgroup/VLAN/DHCP IP address range. For large pools, this meant 1000s of desktops all forced into the same large VLAN, requiring enough IP addresses on the same subnet for each.

On the management side, administrators either had to accept this or implement workarounds to achieve industry standard VLAN sizing of /24 subnets of 256 IP addresses, either creating multiple smaller pools with different parent images, each with their own unique network label specifying the desired subnet size; or manually in vCenter or with the use of a script, modify the network label of each desktop VM to overwrite its parent’s network label after provisioning. This would have to be re-done after recompose/refresh or after modifying the pool size. This was one of the most common hurdles in implementing large pool sizes.

Understanding the new feature…

• Each pool can now be configured with a “network label spec”. This allows an administrator to specify, for each network adapter/NIC on the parent, a list of desired network labels to automatically assign to each newly provisioned desktop in the pool.
• Each label is given a maximum assignment count. After View has provisioned, assigned, and exhausted a network label to its configured capacity for a given NIC, it moves onto the next in the specification list.
• Horizon View remembers the per-pool count of desktop VM’s and their labels provisioned under this feature, so if the pool size is later changed, the configured network label capacity and assignments will be honored.
• This feature only assigns network labels to desktops upon first provisioning – previously created desktops are never modified.
• Network labels are treated similar to MAC addresses – refresh and recompose operations do not revert the child to its parent’s network label state.

Now, this new awesome feature can only be configured thought Horizon View PowerShell and does not have Admin UI support at this point in time.

Configuration is done in three steps:

1. Create a skeleton network label specification text file using parameters from a Cluster/Host and parent VM.
2. Edit the network label specification file to associate available network labels with available NICs, along with maximum capacity counts.
3. Create a new pool or update an existing pool using the network label specification file.

To understand how configure and implement  multi-VLAN support please refer to the Horizon View 5.2 Integration guide avaiable here.

Important Note on Upgrading Existing Pools

The PowerCLI to update an existing pool with the feature is easier to use than creating it from scratch, due to the ability to use Powershell’s piping functionality to populate the myriad other parameters. However, if the upgraded pool initially contained any desktop VMs not provisioned under the feature, the network label assigner will not count any labels on those desktops towards any maximum capacity counts.

Those original desktops can optionally be deleted after the feature is configured to have them re-provisioned and included in the count, or the administrator can configure the feature expecting them to not be included.
Likewise, VMs on the VC not created in the pool do not have their network labels counted against maximum capacity for this feature.

The PowerShell helper…

As you use the tool you will notice that creating  the configuration file with the correct parameters can be a daunting task due to the amount of parameters required.

[css 1=”2="3="4="5="6="7=""smarttabs=""true"""""""""” 2=”3="4="5="6="7="8=""toolbar=""true"""""""""” 3=”4="5="6="7="8="9=""language=""true"""""""""” 4=”5="6="7="8="9="language="""""""""” language=”2=”]Export-NetworkLabelSpecForLinkedClone -vc_id 1a2b3c4d-5e6f –clusterPath "/myresourcepool/host/Cluster1/" -parentVM “/myresourcepool/vm/Win7-Parent" -parentSnapshotPath  "/Win7-Parent/snapshot1"  -maxVMsPerNetworkLabel 244 -networkLabelConfigFile "C:/label.txt"[/css]

To make things easier for the administrators I created a PowerShell script that automatically gather all required parameters, including vd_id, full and relative paths to clusters and pools, and than automatically pipe them to pipe into the Export-NetworkLabelSpecForLinkedClone or Export-NetworkLabelSpecForFullClone.

Place the script in one of the connection servers an run it as follows:

>> Export-NetworkLabel -PoolName “pool_template_name” -Path “c:\label.txt”

There is no need to specify Full or Linked Clone as the script will automatically identify the pool type.

[css 1=”2="3="4="5="6="7=""smarttabs=""true"""""""""” 2=”3="4="5="6="7="8=""toolbar=""true"""""""""” 3=”4="5="6="7="8="9=""language=""true"""""""""” 4=”5="6="7="8="9="language="""""""""” language=”2=”]
<#</pre>
<em id="__mceDel"> .SYNOPSIS
Network Label Config File Automation for Horizon View 5.2</em>

Created by Andre Leibovici

THIS CODE MAY BE CITED, REPRODUCED OR DISTRIBUTED WITHOUT EXPRESS AUTHORIZATION.

.DESCRIPTION
Automates the creation of NIC and Network Label Cofiguration File.
Network COnfiguration File allow administrators to enable multi-VLAN pool deployments.
Must be execute on a VMware View Connection server.

For more information on multi-VLAN support refer to VMware View Integration Guide.

.PARAMETER -PoolName Display Name an existing of template pool in Vmware View
-Path Path to save the Configuration file. By Default c:\label.txt

.EXAMPLE
Export-NetworkLabel -PoolName "pool_template_name" -Path "c:\label.txt"
#>

Function Export-NetworkLabel {
Param (
[parameter(ValueFromPipeline=$false,Position=0,Mandatory=$false)]
[string]$PoolName, [parameter(ValueFromPipeline=$false,Position=1,Mandatory=$false)] [string]$Path = "C:/label.txt"
)

$vc = Get-ViewVC -ErrorAction:SilentlyContinue$pool = Get-Pool -DisplayName $PoolName -ErrorAction:SilentlyContinue if (!$pool) {
Break
}
$clusterPath = ($pool.resourcePoolPath.Split("/") | Select -first 4) -join "/"

if ($pool.desktopSource -eq "SVI") { Export-NetworkLabelSpecForLinkedClone -vc_id$vc.vc_id -clusterPath $clusterPath -parentVM$pool.parentVMPath -parentSnapshotPath $pool.parentVMSnapshotPath -maxVMsPerNetworkLabel 244 -networkLabelConfigFile$Path
} elseif ($pool.desktopSource -eq "VC") { Export-NetworkLabelSpecForFullClone -Vc_id$vc.vc_id -ClusterPath $clusterPath -TemplatePath$pool.templatePath -MaxVMsPerNetworkLabel 244 -NetworkLabelConfigFile \$Path
}

Return ""
}
[/css]

#### 4 pings

1. ##### JoshT

Great article Andre on an much needed feature! This will allow templates to be deployed in different VLANs without having to create duplicate vm/snapshots just to change the NIC config.

2. ##### Ruben

Funny. I created a similar script.
Mine does not require the Pool to exist, but yours look very nice.

You can find it here
http://vmutils.blogspot.co.uk/2013/03/easy-generation-of-configuration-file.html

3. ##### Andre Leibovici

Ruben, thanks for sharing with us. Great script too!

4. ##### dlehrner

Hi Andre, great blog and nice to hear you speak at EMC World.

The script looks great but I am unable to get it to work as is. I’m new to PowerShell/PowerCLI which makes troubleshooting pretty dificult. I am running the script from the primary connection server (brand new 5.2 install) and when I run the script absolutely nothing happens, just a return to the command line with no file created on the root of c:\ and no error messages. I tried modifying the script and it appears that it errors out just completing the function reading the input. If I remove that function and set the variables manually the script completes successfully.

I have a second question that is more about getting familiar with PowerCLI. I noticed that the script Ruben provided includes vsphere powercli commands which do not work in the View PowerCLI window; how do you load both in one window? Do you always run the commands from the connection server or do you just do a import-module of both vsphere and view .dll’s from a desktop?

5. ##### Andre Leibovici

dlehrner, without looking at the issue it is very hard to take a guess. I would recommend you to make sure you start your Powershell session using the View PowerCLI shortcut to make sure the right View DLL’s have been properly loaded. Also, make sure your user is able to run scripts. Run “Set-ExecutionPolicy ByPass”.

Andre

6. ##### sorry

Ditto, this script appears to be dead. Testing on a fresh lab-based View 5.3.1 deployment.

2. ##### How to: Win2K8 w/ PCoIP, Linked Clones, USB, Printing & much more on VMware View » myvirtualcloud.net

[…] those customers and service providers are able to deliver Windows Server 2K8 combined with the new Horizon View Multi-VLAN feature they could effectively service a large part of the DaaS market without incurring into […]

3. ##### Technology Short Take #32 - blog.scottlowe.org - The weblog of an IT pro specializing in virtualization, storage, and servers

[…] Andre Leibovici explains how Horizon View Multi-VLAN works and how to configure it. […]

4. ##### New View Composer Behavior in View 5.2

[…] wasn’t till going over some docs and re-reading Horizon View Multi-VLAN Explained that it dawned on me that View Composer no longer overwrites a desktop’s network label on […]