Assigning VSAN’s to Cisco UCS VSAN Uplinks using Cisco PowerTool
When building out your UCS deployment, you create a series of Fibre Channel (FC) uplinks. Then you have to go back and add those FC uplinks to the VSAN’s that you created. This can be tedious if you have a lot of FC uplinks as you would need to modify each one. With Cisco’s Powertool, you can do this quite quickly with no mouse movement :)
$fabavsan = "VSAN_01" $fabbvsan = "VSAN_02" get-ucsvsan $fabavsan | add-UcsVsanMemberFcPort -portid 13 -slotid 2 -adminstate enabled -switchid A -modifypresent:$true get-ucsvsan $fabavsan | add-UcsVsanMemberFcPort -portid 14 -slotid 2 -adminstate enabled -switchid A -modifypresent:$true get-ucsvsan $fabavsan | add-UcsVsanMemberFcPort -portid 15 -slotid 2 -adminstate enabled -switchid A -modifypresent:$true get-ucsvsan $fabavsan | add-UcsVsanMemberFcPort -portid 16 -slotid 2 -adminstate enabled -switchid A -modifypresent:$true get-ucsvsan $fabbvsan | add-UcsVsanMemberFcPort -portid 13 -slotid 2 -adminstate enabled -switchid A -modifypresent:$true get-ucsvsan $fabbvsan | add-UcsVsanMemberFcPort -portid 14 -slotid 2 -adminstate enabled -switchid A -modifypresent:$true get-ucsvsan $fabbvsan | add-UcsVsanMemberFcPort -portid 15 -slotid 2 -adminstate enabled -switchid A -modifypresent:$true get-ucsvsan $fabbvsan | add-UcsVsanMemberFcPort -portid 16 -slotid 2 -adminstate enabled -switchid A -modifypresent:$true
As you can see:
$fabavsan = "VSAN_01" $fabbvsan = "VSAN_02"
are variable used so that you only need to modify the VSAN ID once. Otherwise, you would need to specify on each and every line.
This took me a while to figure out as Cisco’s get-help files (man pages for Linux folks) leave a lot to be desired.
if you run:
get-help add-ucsvsanmemberfcport -full
You get:
NAME Add-UcsVsanMemberFcPort SYNOPSIS Adds Managed Object of type FabricFcVsanPortEp. SYNTAX Add-UcsVsanMemberFcPort -Vsan <FabricVsan> [-PortId] <uint> [-SlotId] <uint> [-SwitchId] <string> [-AdminState <string>] [-Name <string>] [-ModifyPresent] [-XtraProperty <Hashtable>] [-Ucs <UcsHandle[]>] [ <CommonParameters>] DESCRIPTION Adds Managed Object of type FabricFcVsanPortEp. FC Port that attaches to the parent VSAN. Indicates the parent VSAN will be configured on the specified FC port (FC storage port or FC uplink port). This is configured explicitly by the user. PARAMETERS -Vsan <FabricVsan> Specifies a Vsan object. The Vsan must already exist. Required? true Position? named Default value Accept pipeline input? Accept wildcard characters? -PortId <uint> Specifies the port identifier. Required? true Position? named Default value Accept pipeline input? Accept wildcard characters? -SlotId <uint> Specifies the slot identifier. Required? true Position? named Default value Accept pipeline input? Accept wildcard characters? -SwitchId <string> Specifies the switch id. Valid values are: A, B, NONE Required? true Position? named Default value Accept pipeline input? Accept wildcard characters? -AdminState <string> The administrative (desired) state of this end-point. Valid values are: disabled, enabled Required? true Position? named Default value Accept pipeline input? Accept wildcard characters? -Name <string> NO COMMENTS Required? true Position? named Default value Accept pipeline input? Accept wildcard characters? -ModifyPresent The ModifyPresent option ensures that the add-cmdlets modify the MO, if it already exists, instead of returning an error. Required? true Position? named Default value Accept pipeline input? Accept wildcard characters? -XtraProperty <Hashtable> The XtraProperty parameter ensures that unknown Managed Object properties can also be used. Required? true Position? named Default value Accept pipeline input? Accept wildcard characters? -Ucs <UcsHandle[]> Specifies a list of ucs connection object(s) Required? true Position? named Default value Accept pipeline input? Accept wildcard characters? <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For more information, type, "get-help about_commonparameters".
Which would lead you to believe that this command would work just fine:
add-UcsVsanMemberFcPort -Vsan VSAN_01 -portid 13 -slotid 2 -adminstate enabled -switchid A -modifypresent:$true
But it does not, you have to pipeline through the get-ucsvsan output first.
Tags: cisco, Cisco UCS, cloud, deployment, help files, linux, PowerShell, powertool