You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ChangeLog.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
1
### ChangeLog for vNugglets.VDNetworking PowerShell module
2
2
3
+
#### v1.2.0, Jun 2018
4
+
-\[enhancement] Added `Set-VNVMHostNetworkAdapterVDUplink` for setting the VDSwitch Uplink for a VMHost physical NIC ("VMNIC") on the VDSwitch of which the VMNIC is already a part
5
+
-\[enhancement] Added `Get-VNVSwitchByVMHostNetworkAdapter` for getting the virtual switch (standard or distributed) with which the given VMHostNetworkAdapter physical NIC is associated, if any
6
+
3
7
#### v1.1.0, Jan 2018
4
8
-\[update] Added `-WhatIf` support to `New-VNVDTrafficRuleAction`, `New-VNVDTrafficRuleQualifier`
5
9
-\[bugfix]`-Enabled` parameter on `Set-VNVDTrafficRuleSet` was not working as expected. Fixed
Copy file name to clipboardExpand all lines: ToDoAndNotes.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,11 @@
1
-
## Notes on Traffic Filtering and Marking code
1
+
## Notes on vNugglets.VDNetworking PowerShell module
2
2
3
3
4
4
### Need to make:
5
5
- Tests (partial, currently, written for interactive test, not fully automated)
6
6
7
7
### Maybe eventually add/update:
8
+
-`Set-VNVMHostNetworkAdapterVDUplink`: add check that, if all specified VMHostNetworkAdapters are already associated with the given UplinkNames, take no action and return a Verbose message to that effect ("already in desired state"); approximate start/finish points for this feature are noted in comments in the code
default {Write-Warning"vSwitch not of expected type of either [VMware.Vim.HostVirtualSwitch] or [VMware.Vim.HostProxySwitch]. What kind of vSwitch is it? $_"}
241
+
} ## end switch
242
+
} ## end if
243
+
else {Write-Verbose"No vSwitch associated with VMNIC '$($oThisVMHostNetworkAdapter.Name)' found on VMHost '$($oThisVMHostNetworkAdapter.VMHost.Name)'"}
Set the VMNICs "vminic2", "vminic3" from VMHost myVMHost0.dom.com to be in VDUplinks "Uplinks-01", "Uplinks-02" on VDS myVDSwitch0 (the vDSwitch of which VMNIC2 and VMNIC3 are a part)
54
+
Could then check out the current status like:
55
+
Get-VDSwitch myVDSwitch0 | Get-VDPort -Uplink | Where-Object {$_.ProxyHost.Name -eq "myVMHost0.dom.com"} | Select-Object key, ConnectedEntity, ProxyHost, Name | Sort-Object ProxyHost, Name
56
+
57
+
.Notes
58
+
One cannot put two VMNICs from a VMHost in the same vDUplink -- they should go into separate/unique vDUplinks
59
+
Requires that VMHostNetworkAdapter(s) are all associated with a single vDSwitch (not VMNICs from multiple vDSwitches) and that the vSwitch type is _Distributed_ (not Standard)
60
+
61
+
Function checks that:
62
+
- all VMHostNetworkAdapters specified are on same VMHost and same vDSwitch
63
+
- all UplinkNames specified are on same vDSwitch
64
+
65
+
The core NetworkSystem and config spec syntax is based on LucD's post (of course) at https://code.vmware.com/forums/2530/vsphere-powercli#576477?start=15&tstart=0
66
+
67
+
.Outputs
68
+
VMware.VimAutomation.Vds.Types.V1.VDPort for the Uplink VDPort with which the VMNIC(s) are now affiliated
## The VMHost Network Adapter(s) ("VMNIC") to set in a given vDUplink. If more than one specified, then specify the same number of -UplinkName values, too. The first VMHostNetworkAdapter will be set to the first UplinkName, the second to the second UplinkName, and so on
## The name(s) of the vDUplink with which to associate the VMNIC. If more than one specified, then specify the same number of -VMHostNetworkAdapter values, too
77
+
[parameter(Mandatory=$true)][String[]]$UplinkName
78
+
) ## end param
79
+
80
+
process {
81
+
## make sure that the same number of VMNICs and UplinkNames were provided
82
+
if (($VMHostNetworkAdapter|Measure-Object).Count -eq ($UplinkName|Measure-Object).Count) {
if (($oTargetVMHost|Measure-Object).Count -gt1) {Write-Error"VMHostNetworkAdapters provided are from more than one VMHost. Specify VMNICs from just a single VMHost"}
87
+
## else, the VMNICs are from the same VMHost
88
+
else {
89
+
## get VDSwitch(es) of which VMNIC is a part (uses another function in this module)
## if all VMHostNetworkAdapters are associated with vSwitches (num VMNICs is different than num of retrieved vSwitches), and all VMNICs are from same vSwitch
95
+
if ((($arrTargetVSwitches|Measure-Object).Count -eq$VMHostNetworkAdapter.Count) -and (($oTargetVDSwitch|Measure-Object).Count -eq1)) {
96
+
## get the DistributedVirtualSwitchHostMember object for this VMHost and vDSwitch; this object has things like the VDPorts that are the Uplink ports for this VMHost on this vDSwitch, the current PNIC backing info for this VMHost/vDSwitch (if any), etc.
## get the vDUplink ports for this VDSwitch and this VMHost -- the <vDSwitch>.ExtensionData.Config.Host objects have subsequent property ".Config.Host" (yes, same property names again) from which to determine the corresponding item by VMHost ID
## get the UplinkName(s) specified that are not defined on the target vDSwitch (as returned by Compare-Object with a property of SideIndicator with a value of "=>" -- meaning, they were in the DifferenceObject and not the ReferenceObject)
## if all values of $UplinkName are valid for this VDSwitch
104
+
if ($null-eq$arrUplinkNamesNameOnVDSwitch) {
105
+
## the TODO of "check that there are any arrVDUplinks_thisVDS_thisVMHost where the VMNIC <--> UplinkName correlation needs changed" would start about here:
106
+
107
+
## make the messages for ShouldProcess()
108
+
$strShouldProcessMsg_target="vDSwitch '{0}' for VMHost '{1}'"-f$oTargetVDSwitch.Name,$oTargetVMHost.Name
109
+
$strShouldProcessMsg_action="Set VMNIC{0} '{1}' to be in vDUplink{0} '{2}'"-f$(if ($VMHostNetworkAdapter.Count-ne1) {"s"}), ($VMHostNetworkAdapter.Name-join", "), ($UplinkName-join", ")
110
+
if ($PSCmdlet.ShouldProcess($strShouldProcessMsg_target,$strShouldProcessMsg_action)) {
111
+
## get NetworkSystem for the VMHost for this VMNIC
## the PnicSpecs from above -- the existing "other" ones for other VMNICs on this vDS for this VMHost, and the new PnicSpec(s) for the VMHostNetworkAdapter(s)
## return an object with the VMNIC and vDUplink info for vDUplinks for this VMHost on this vDSwitch
145
+
Get-VDPort-Key $oVDSwitchHostMember.UplinkPortKey-VDSwitch $oTargetVDSwitch|Sort-Object ProxyHost, Name
146
+
} ## end try
147
+
catch {$PSCmdlet.ThrowTerminatingError($_)}
148
+
} ## end if ShouldProcess()
149
+
150
+
## the TODO of "check that there are any arrVDUplinks_thisVDS_thisVMHost where the VMNIC <--> UplinkName correlation needs changed" would end about here
151
+
} ## end if all values of $UplinkName are valid for this VDSwitch
Write-Error ("Uplink{0} '{1}' {2} not in '{3}' for vDSwitch '{4}', in which '{5}' take part. Please specify only Uplink names that are in use on this vSwitch."-f$(if ($intNumSpecifiedUplinkNamesNotOnThisVSwitch-ne1) {"s"}), ($arrUplinkNamesNameOnVDSwitch.InputObject-join", "),$(if ($intNumSpecifiedUplinkNamesNotOnThisVSwitch-ne1) {"are"} else {"is"}), ($arrVDUplinks_thisVDS_thisVMHost.Name-join", "),$oTargetVDSwitch.Name, ($VMHostNetworkAdapter.Name-join", "))
156
+
} ## end else
157
+
} ## end if all VMHostNetworkAdapters are associated with vSwitches (num VMNICs is different than num of retrieved vSwitches), and all VMNICs are from same vSwitch
158
+
159
+
else {Write-Error"Either the VMNICs specified are not all associated with a vSwitch, or are not all are associated with the same vSwitch. Please check that all VMNICs are a part of the same vDSwitch"}
160
+
} ## end else the VMNICs are from the same VMHost
161
+
} ## end if same number of VMNICs and UplinkNames were provided
162
+
else {Write-Error ("A different number of VMNICs ({0}) and UplinkNames ({1}) were specified. Please specify the same number of values for -VMHostNetworkAdapter and -UplinkName"-f$VMHostNetworkAdapter.Count,$UplinkName.Count)}
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
84
85
CmdletsToExport=@()
@@ -111,7 +112,7 @@ PrivateData = @{
111
112
PSData=@{
112
113
113
114
# Tags applied to this module. These help with module discovery in online galleries.
0 commit comments