VMware Cloud Community
zhornsby
Enthusiast
Enthusiast
Jump to solution

Remove unused DVuplinks for DVswitch

i recently had a few network changes within my lab environment and i have to decrease my amount of uplink ports on my dvswitch from 7 to 4. i removed the physical nics from the dvswitch but now im left with 3 unused dvUplinks. when i try to reduce the amount of uplinks from the edit settings window on the dvswitch i get a "resource 1707 is in use on host x.x.x.x"

does anyone know how else i can remove the unused dvuplinks from my dvswitch.

6.0 vcsa, dvswitch 5.5 (didnt notice until now, will upgrade to 6.0)

Tags (1)
Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Ok, now I have a clear picture of the issue.

Your Uplinks are not in order, it says Uplink1, Uplink2, Uplink4, Uplink3.

And the Uplinks are connected to the last 4 ports that are reserved for Uplinks.

This is probably due to changing/removing Uplinks in the past.
I will now have to find a way to link the Uplinks to the correct ports, and do the removal in the correct order.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
25 Replies
LucD
Leadership
Leadership
Jump to solution

Do you by any chance still have an ESXi host connected to one of the Uplinks?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
zhornsby
Enthusiast
Enthusiast
Jump to solution

i do not. i have three host in the cluster, dvuplinks 1,2,3,4 have vmnic's 3,4,5,6 (vmnic 1,2 are assigned to a standard switch) assigned to them respectively. dvuplinks 5,6,7 have no vmnics assigned to them on either one of the hosts

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Try like this.

Note that there is no checking if  any of the dropped Uplinks has a connection.

$vdsName = 'MyVds'

$vdsUplinkNumber = 2

$vds = Get-VDSwitch -Name $vdsName

$spec = New-Object VMware.Vim.VMwareDVSConfigSpec

$spec.ConfigVersion = $vds.ExtensionData.Config.ConfigVersion

$uplink = New-Object VMware.Vim.DVSNameArrayUplinkPortPolicy

$uplink.UplinkPortName = @()

1..$vdsUplinkNumber | %{

    $uplink.UplinkPortName += $vds.ExtensionData.Config.UplinkPortPolicy.UplinkPortName[$_ - 1]

}

$spec.UplinkPortPolicy = $uplink

$vds.ExtensionData.ReconfigureDvs($spec)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
zhornsby
Enthusiast
Enthusiast
Jump to solution

$vdsName = 'Lab_DV_SW'

$vdsUplinkNumber = 2

$vds = Get-VDSwitch -Name $vdsName

$spec = New-Object VMware.Vim.VMwareDVSConfigSpec

$spec.ConfigVersion = $vds.ExtensionData.Config.ConfigVersion

$uplink = New-Object VMware.Vim.DVSNameArrayUplinkPortPolicy

$uplink.UplinkPortName = @()

1..$vdsUplinkNumber | %{

$uplink.UplinkPortName += $vds.ExtensionData.Config.UplinkPortPolicy.UplinkPortName[$_ - 1]

}

$spec.UplinkPortPolicy = $uplink

$vds.ExtensionData.ReconfigureDvs($spec)

Made my changes, submitted, error returned "Exception calling "ReconfigureDvs" with "1" argument(s): "The resource '1707' is in use. The Uplink name dvUplink3 is in use by the connected uplink port 1707 on host x.x.0.18, which is connected to the physical network adapter vmnic5"

this error is true as dvuplink3 is connected to vmnic 5, however im not trying to remove dvuplink3. im trying to remove dvuplink 5, 6, 7

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

I'm confused, Uplinks are normally numbered sequentially.
Do you have empty Uplinks in the sequence?

Perhaps show a screenshot of the topology to help me understand.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
zhornsby
Enthusiast
Enthusiast
Jump to solution

They are in order, however i have vmnic 1,2 assigned to a standard switch for kernel traffic

dvswitch.PNGstandardswitch.PNG

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

But wait a minute, you seem to have specified

$vdsUplinkNumber = 2

That should say

$vdsUplinkNumber = 4

That way you will bring down the number of Uplinks from 7 to 4.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
zhornsby
Enthusiast
Enthusiast
Jump to solution

whoops i pasted it wrong back into the thread. this was the result

pwcli.PNG

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Ok, can you tell me what these show?

$vds.ExtensionData.Config.UplinkPortPolicy

$spec.UplinkPortPolicy


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
zhornsby
Enthusiast
Enthusiast
Jump to solution

pwcli2.PNG

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

I'm flabbergasted. That all looks normal and how I expected it to be :smileycry:

Ok, I think at this point we should have a look at the vpxd log.
See if you can find the entries from around the time you executed the call to the method.

On the other hand, since you also seem to get this error when you do the same via the Web Client, I'm wondering if there isn't anything else causing this error.
The vpxd log could give us some more info on that as well.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
zhornsby
Enthusiast
Enthusiast
Jump to solution

i dont see anything in the vpxd logs. are you referring to vpxd.log correct? not the vpxd-profiler logs

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Correct, not the vpxd profiler logs.

Could you run the following and check if the mentioned port is in there?

$vds = Get-VDSwitch -Name <your-vds>

$vds.ExtensionData.Config.Host |

ForEach-Object -Process {

    $esx = Get-View -Id $_.Config.Host

    Write-Host "ESXi $($esx.Name)  Ports $($_.UplinkPortKey -join '|')"

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
zhornsby
Enthusiast
Enthusiast
Jump to solution

Capture.PNG

doesnt seem to like your first command

Reply
0 Kudos
zhornsby
Enthusiast
Enthusiast
Jump to solution

did you mean $vdsname?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Just the name of the switch, without the <>


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
zhornsby
Enthusiast
Enthusiast
Jump to solution

gotchya, sorry about that.

it doesnt seem to report anything Capture.PNG

is there a way to identify which dvuplink specifically you want to remove?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

I didn't want to remove anything with that script, just wanted to know to which VDS ports the uplinks were connected for each ESXi node.

The script wasn't finished in your run (that is what the >> mean).

Type } followed by <enter>, and then another <enter>


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
zhornsby
Enthusiast
Enthusiast
Jump to solution

Capture.PNG

whoops sorry about that, im new to powercli. still trying to learn it

Reply
0 Kudos