Hello,
We had some problem with a HostProfile that's shown as noncompliant (even on the Reference Host) with the exception :
For port group xxx network policy property spec.policy.nicTeaming.failureCriteria doesn't match
After further check, we discover that some property of spec.policy.nicTeaming.failureCriteria doesn't match with the other host (and with the hostprofile)
With the help of other post by LucD, we've check the property that mismatch
$clusNameToCheck = "xxx" $portGroupToCheck = "xxx" $report = @() $hostsClus = Get-Cluster -Name $clusNameToCheck | Get-VMHost | Get-View foreach($esx in $hostsClus){ $esx.Config.Network.PortGroup | where {$_.Key -eq "key-vim.host.PortGroup-$portGroupToCheck"} | %{ $repEsx = "" | select-Object Name, checkSpeed, speed, checkDuplex, fullDuplex, checkErrorPercent, percentage, checkBeacon $repEsx.Name = $esx.name $repEsx.checkSpeed = $_.Spec.Policy.NicTeaming.FailureCriteria.checkSpeed $repEsx.speed = $_.Spec.Policy.NicTeaming.FailureCriteria.speed $repEsx.checkDuplex = $_.Spec.Policy.NicTeaming.FailureCriteria.checkDuplex $repEsx.fullDuplex = $_.Spec.Policy.NicTeaming.FailureCriteria.fullDuplex $repEsx.checkErrorPercent = $_.Spec.Policy.NicTeaming.FailureCriteria.checkErrorPercent $repEsx.percentage = $_.Spec.Policy.NicTeaming.FailureCriteria.percentage $repEsx.checkBeacon = $_.Spec.Policy.NicTeaming.FailureCriteria.checkBeacon $report += $repEsx } } $report | Format-Table -Autosize
For exemple, on the cluster that have problem, the result is :
Name checkSpeed speed checkDuplex fullDuplex checkErrorPercent percentage checkBeacon ---- ---------- ----- ----------- ---------- ----------------- ---------- ----------- xxx 0 False False False 0 False xxx minimum 10 False False False 0 False xxx minimum 10 False False False 0 False xxx minimum 10 False False False 0 False xxx minimum 10 False False False 0 False xxx 0 False False False 0 False xxx minimum 10 False False False 0 False xxx minimum 10 False False False 0 False
We can see that 2 hosts have the checkSpeed and speed parameter different from the others.
On the HostProfile configuration, we see (after an xml update) this conf :
<policy> <id>NetworkFailoverPolicy</id> <policyOption> <id>FixedFailoverCriteria</id> <parameter> <key>criteria</key> <value xsi:type="HostNicFailureCriteria"> <checkSpeed>minimum</checkSpeed> <speed>10</speed> <checkDuplex>false</checkDuplex> <fullDuplex>false</fullDuplex> <checkErrorPercent>false</checkErrorPercent> <percentage>0</percentage> <checkBeacon>false</checkBeacon> </value> </parameter> </policyOption> </policy>
So we think that the non-compliance of the HostProfile for the 2 host is caused by this mismatch.
We wanted to know if using the UpdatePortGroup method to correct this mismatch will not cause any interruption of network trafic.
And is there another way to update theses values than through PowerCLI (we don't see theses values through vSphere Client) ?
We found an A.Renouf post about updating PortGroup property (http://www.virtu-al.net/2010/01/13/powercli-automating-traffic-shaping-on-portgroups/), we'll use it if it doesn't impact network flow.
Thanks in advance for your help !
You have to specify the portgroup name as a parameter.
Otherwise it works for me.
$hostESX = "xxx" $pgname = "xxx" $vSwitch = "xxx" $esx = Get-VMHost "$hostESX" | Get-View $net = Get-View $esx.configmanager.networksystem $portgroupspec = New-Object VMWare.Vim.HostPortGroupSpec $portgroupSpec.vswitchname = $vSwitch $portgroupspec.Name = $pgname $portgroupspec.policy = New-object vmware.vim.HostNetworkPolicy $portgroupspec.policy.NicTeaming = New-object vmware.vim.HostNicTeamingPolicy $portgroupspec.policy.NicTeaming.failureCriteria = $null $portgroupspec.policy.NicTeaming.failureCriteria = New-Object vmware.vim.HostNicFailureCriteria $portgroupspec.policy.NicTeaming.failureCriteria.checkSpeed = "minimum" $portgroupspec.policy.NicTeaming.failureCriteria.speed = 10 $net.UpdatePortGroup($pgname,$PortGroupSpec)
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Afaik, as long as you don't change the NIC teaming (active-standby NICS), there should be no traffic interruption.
But as always, I would advise you to test this yourself !
You can access some of the NIC failure settings via the vSphere client (under the NIC Teaming tab), but not all of them.
See also my document.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for your quick answer, we'll check that and post result.
Just to have second opinion, does this code seems to be correct for you ? :
$hostESX = "xxx" $pgname = "xxx" $vSwitch = "xxx" $esx = Get-VMHost "$hostESX" | Get-View $net = Get-View $esx.configmanager.networksystem $portgroupspec = New-Object VMWare.Vim.HostPortGroupSpec $portgroupSpec.vswitchname = $vSwitch $portgroupspec.Name = $pgname $portgroupspec.policy = New-object vmware.vim.HostNetworkPolicy $portgroupspec.policy.NicTeaming = New-object vmware.vim.HostNicTeamingPolicy $portgroupspec.policy.NicTeaming.failureCriteria = $null $portgroupspec.policy.NicTeaming.failureCriteria = New-Object vmware.vim.HostNicFailureCriteria $portgroupspec.policy.NicTeaming.failureCriteria.checkSpeed = "minimum" $portgroupspec.policy.NicTeaming.failureCriteria.speed = 10 $net.UpdatePortGroup($PortGroupSpec)
Ce message a été modifié par: fredericmartin
You have to specify the portgroup name as a parameter.
Otherwise it works for me.
$hostESX = "xxx" $pgname = "xxx" $vSwitch = "xxx" $esx = Get-VMHost "$hostESX" | Get-View $net = Get-View $esx.configmanager.networksystem $portgroupspec = New-Object VMWare.Vim.HostPortGroupSpec $portgroupSpec.vswitchname = $vSwitch $portgroupspec.Name = $pgname $portgroupspec.policy = New-object vmware.vim.HostNetworkPolicy $portgroupspec.policy.NicTeaming = New-object vmware.vim.HostNicTeamingPolicy $portgroupspec.policy.NicTeaming.failureCriteria = $null $portgroupspec.policy.NicTeaming.failureCriteria = New-Object vmware.vim.HostNicFailureCriteria $portgroupspec.policy.NicTeaming.failureCriteria.checkSpeed = "minimum" $portgroupspec.policy.NicTeaming.failureCriteria.speed = 10 $net.UpdatePortGroup($pgname,$PortGroupSpec)
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for your help, I thought the
$portgroupspec.Name = $pgname
could be enough.
I know it's double entry, but the UpdatePortGroup method requires it I'm afraid
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference