Remove host from cluster error “Cannot remove the host because it’s part of VDS dvSwitch”

I reveived an error while trying to remove a host from a cluster.

Cannot remove the host [hostname] because it’s part of VDS [dvSwitch name]

remove-host-dvswitch-01

 

 

This error is correct 🙂 As you can probably see by it’s name, this host is connected to a dvSwitch called dvSwitch-vMotion. Obviously it’s used for vMotion. To be able to remove the host from the cluster I had to disconnect it from the dvSwitch.

Press Ctrl-Shift+N and you get to the networking part of your vCenter Server Inventory. Select your dvSwitch

remove-host-dvswitch-02

 

and select the Host tab

remove-host-dvswitch-03

 

Now select the host you want to remove and right-click on it. Select the ‘Remove from vSphere Distributed Switch’ option

remove-host-dvswitch-04

 

Read the following error very closely. You could put yourself in trouble if you disconnect the wrong port-groups

remove-host-dvswitch-05

 

If you have decided it’s safe to remove the host anyway, you will most probably receive the following error

remove-host-dvswitch-06

 

vDS [dvSwitch name] port [port number] is still on host [hostname] connected to [hostname] nic=vmk1 type=hostVmknic

This error is also correct 😉 You have not disconnected the virtual adapter from the portgroup!

Go back to your host. Select the Configuration tab and go to the Networking config. Select vSphere Distributed Switch. Here you can see the virtual adapter that’s still connected to the portgroup.

remove-host-dvswitch-07

 

Select Manage Virtual Adapters. You’ll see a list of the connected adapters. I’m my case it’s only 1. Select the adapter you want to remove and click Remove. Again, think a second about the warning.

remove-host-dvswitch-08

 

Now you’re able to disconnect the server from the dvSwitch. Press Ctrl-Shift+N again and remove the host from the vSphere Distributed Switch. The remove process will disconnect your dvUplinks for you and your physical adapters will be free for other use.

remove-host-dvswitch-09

 

And now you’re able to remove your host from the cluster.

remove-host-dvswitch-10

 

Congrats, you did it! Have a good one.

Advertisements

Set the Path Selection Policy for every device path of every host in your vSphere 5.0/5.1 cluster using PowerCLI

I created a new cluster with 4 hosts and forgot to set the default Path Selection Policy (PSP). To fix this I’ll use PowerCLI. In my case I want to use the PSP RoundRobin for all my device paths to disks. Change the PSP according to your preferrence.

First get all device paths that do not use the Round Robin PSP:

Get-Cluster [ClusterName] | Get-VMHost | Get-ScsiLun -LunType disk | Where {$_.MultipathPolicy -ne “RoundRobin”}

which gave me this output:

CanonicalN ConsoleDeviceName LunType CapacityMB MultipathPolicy
ame
———- —————– ——- ———- —————
naa.600… /vmfs/devices/disks/naa.600… disk 768000 Fixed
naa.600… /vmfs/devices/disks/naa.600… disk 768000 Fixed
naa.600… /vmfs/devices/disks/naa.600… disk 768000 Fixed
naa.600… /vmfs/devices/disks/naa.600… disk 768000 Fixed
naa.600… /vmfs/devices/disks/naa.600… disk 768000 Fixed
etc.

After this, just set the PSP for those device paths with the command:

Get-Cluster [ClusterName] | Get-VMHost | Get-ScsiLun -LunType disk | Where {$_.MultipathPolicy -ne “RoundRobin”} | Set-ScsiLun -MultipathPolicy “RoundRobin”

Which gave me what I wanted:

CanonicalN ConsoleDeviceName LunType CapacityMB MultipathPolicy
ame
———- —————– ——- ———- —————
naa.600… /vmfs/devices/disks/naa.600… disk 768000 RoundRobin
naa.600… /vmfs/devices/disks/naa.600… disk 768000 RoundRobin
naa.600… /vmfs/devices/disks/naa.600… disk 768000 RoundRobin
naa.600… /vmfs/devices/disks/naa.600… disk 768000 RoundRobin
naa.600… /vmfs/devices/disks/naa.600… disk 768000 RoundRobin
etc.

Now to prevent future misconfigured PSP’s, I want to set the default PSP for my default Storage Array Type to Round Robin. I’ll use the following script to get the available SATP’s of all my hosts (normally, they should be the same on all hosts):

Get-Cluster [ClusterName]| Get-VMHost | ForEach-Object {
$esxcli = Get-EsxCli -VMHost $_
$esxcli.storage.nmp.satp.list()
}

Output (of 1 host):

PowerCLI D:\get_all_satp_available.ps1

DefaultPSP Description Name
———- ———– —-
VMW_PSP_MRU Placeholder (plugin not loaded) VMW_SATP_MSA
VMW_PSP_MRU Placeholder (plugin not loaded) VMW_SATP_ALUA
VMW_PSP_MRU Placeholder (plugin not loaded) VMW_SATP_DEFAULT_AP
VMW_PSP_FIXED Placeholder (plugin not loaded) VMW_SATP_SVC
VMW_PSP_FIXED Placeholder (plugin not loaded) VMW_SATP_EQL
VMW_PSP_FIXED Placeholder (plugin not loaded) VMW_SATP_INV
VMW_PSP_FIXED Placeholder (plugin not loaded) VMW_SATP_EVA
VMW_PSP_RR Placeholder (plugin not loaded) VMW_SATP_ALUA_CX
VMW_PSP_RR Placeholder (plugin not loaded) VMW_SATP_SYMM
VMW_PSP_MRU Placeholder (plugin not loaded) VMW_SATP_CX
VMW_PSP_MRU Placeholder (plugin not loaded) VMW_SATP_LSI
VMW_PSP_RR Supports non-specific active/active … VMW_SATP_DEFAULT_AA
VMW_PSP_FIXED Supports direct attached devices VMW_SATP_LOCAL

VMW_SATP_DEFAULT_AA is what SATP is in use. I’ll use that one to set the default PSP on.

And a list of all available PSP’s:

Get-Cluster [ClusterName]| Get-VMHost | ForEach-Object {
$esxcli = Get-EsxCli -VMHost $_
$esxcli.storage.nmp.psp.list()
}

Output (of 1 host):

PowerCLI D:\get_all_psp_available.ps1

Description Name
———– —-
Most Recently Used Path Selection VMW_PSP_MRU
Round Robin Path Selection VMW_PSP_RR
Fixed Path Selection VMW_PSP_FIXED

PowerCLI D:\>

In my case, I want to make VMW_PSP_RR the default PSP for SATP VMW_SATP_DEFAULT_AA. So I use the script to set it:

Get-Cluster [ClusterName]| Get-VMHost | ForEach-Object {
$esxcli = Get-EsxCli -VMHost $_
$esxcli.storage.nmp.satp.set($null,”VMW_PSP_RR”,”VMW_SATP_DEFAULT_AA”)
}

And that gives mw what I want. Because there are 4 hosts in my cluster, the output is repeated 4 times:

PowerCLI > D:\set_all_satp_to_psp.ps1
Default PSP for VMW_SATP_DEFAULT_AA is now VMW_PSP_RR
Default PSP for VMW_SATP_DEFAULT_AA is now VMW_PSP_RR
Default PSP for VMW_SATP_DEFAULT_AA is now VMW_PSP_RR
Default PSP for VMW_SATP_DEFAULT_AA is now VMW_PSP_RR
PowerCLI > D:\

Have a good one 🙂

%d bloggers like this: