Typically, unpreparing a host in vCloud Director is fairly straightforward and works without issue. In the rare occasion it doesn’t work, there are posted workarounds for manually removing the vcloud-agent from the vSphere Host through the esxcli. Well, what about the even rarer chance you need to remove the vCloud Director agent from a vSphere Host while it still has workloads (VMs) running on it?

I can’t speak for the type of support you’d get in a situation like this, so consider this to be unsupported as of now. Imagine the scenario you, for some reason, lost or deleted your vCloud Director instance and needed to rebuild it and add your hosts back in but they have workloads powered on that you just can’t power off or migrate for whatever reason.

Well, here’s a workaround that can get you out of trouble in a pinch (again, I’m assuming this is your lab environment, unless you’ve checked with VMware support for their blessing on performing this action).

Log into the ESXi (vSphere Host) shell and perform the following action:

Successfully removed agent while not requiring a reboot:

Now, you will be able to go into your new vCloud Director environment and prepare this host:

This host has been successfully prepared:

So, not all is lost if you ever encounter this situation. I keep trying to think of all the situations in which this type of action would need to occur (no VMotion availalbe, host affininity requirements, etc), and I come up with many blanks. I’d be curious to hear from you if you have run into this or if you run “other” workloads on your vCloud Director hosts (required appliances unrelated to vCloud Director that need host affinity?).

Get notification of new blog postings and more by following Harry on Twitter: @HarrySiii