vCenter is your management tool. Therefore, all deploys and deletes need to be conducted against vCenter and not ESXi directly. This is the way vSphere is supposed to work.
Agree with your point. But, since ESXi is providing an interface for VM and resource management, shouldn't the local (ESXi host) changes reflect in vCenter in a consistent manner? I mean, VM deletion seems to be behaving differently when compared to VM creation.
What makes the VM go orphaned in vCenter? Is there some ESXi CLI command to push the local changes to vCenter, or something else of that sort?
Because once you bring an ESXi host under management with vCenter, the single source of truth lies with vCenter because it's in charge of the management. When you start making changes in two different places, there are difficulties in reconciling those changes. So when you go behind vCenter's back and start making modifications directly to ESXi, some things don't get picked up. Again, when you're doing these types of bring-ups/downs, you really need to be targeting vCenter, not the host(s) individually.
Because you bypass vpxd and connect direct by vpxa
vpxa agent communicate with vpxd when we connect vcenter server by web-client/vc-client
you are connecting host directly that's wy only vpxa agent is cumming in picture , and vpxd is not refreshing during vm deletion, if you restart vpxd then you will not see orphaned vm in vcenter server.
So, I believe that restarting vpxa alone, on the ESXi host, is not going to help, right?
Does vpxd have some periodic refresh? Would these orphaned entries get trashed eventually, or are they going to last until vpxd restart / manual inventory clean up?
I have already tried the refresh from vCenter vSphere Web Client. That didn't help; the orphaned VMs continue to show up after refresh.
Does vpxd have some auto refresh interval?
It does but, once again, it doesn't refresh things like this. That's why you need to perform your ops against vCenter and not the host. There's no way to get around that properly.
1 person found this helpful
I've just experienced a similar problem. A VM was removed from ESXi instead of vCenter. There was no trace of the VM's files; they were long since deleted. But the VM showed as an artifact in vCenter only as (orphaned).
While "daphnissov" provides sound advice, it's rather sad that his solution requires time travel. I hope this actually helps:
Since there were no valid vCenter options, I restarted my vCenter appliance VM. Not the most graceful act to be sure. I suggest restarting it from the ESXi console, for no good technical reason.
When the vCenter console became available, the artifact still existed. However, this time a right-click yielded a useful menu. Including "remove from inventory", which successfully removed the artifact.
It most cases rebooting the ESXi yields the "remove from inventory" option from VC .
This can also be achieved by removing the stale VM from vCenter Database. Please connect with VMware Support Team for help if you are not sure . stop vpxd service and then perform the delete from VCDB .
In my case, I don't see any problem deleting this entry manually via vCenter. Without any service/system restarts, in vCenter I see the "Remove from Inventory" option for these orphaned VMs.
I was wondering if there's some way these orphaned VM could be removed without getting into vCenter; preferably via ESXi.
Looks like there's no such options available. The cleanup has to happen via vCenter.
You can use PowerCLI using Remove-VM <orphaned VM to delete>