VMware Cloud Community
sachin8d87
Contributor
Contributor

Vcenter shows VM as orphaned when VM is deleted from ESXi host/webui

I have an ESXi host connected to a vCenter. While testing out a couple of VM deployments/undeployments, its observed that whenever a new VM is created via the ESXi WebUI the VM shows up immediately in vCenter, but when it's deleted/unregistered via the ESXi WebUI the VM shows up as orphaned in vCenter.

I was expecting the VM be deleted from the vCenter inventory. I believe, vCenter should detect the delete operation on ESXi host and update it's own inventory automatically. Is that a wrong expectation?

vCenter and ESXi host are running on 6.5.

Reply
0 Kudos
12 Replies
daphnissov
Immortal
Immortal

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.

Reply
0 Kudos
sachin8d87
Contributor
Contributor

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?

Reply
0 Kudos
daphnissov
Immortal
Immortal

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.

Reply
0 Kudos
RajeevVCP4
Expert
Expert

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.

Rajeev Chauhan
VCIX-DCV6.5/VSAN/VXRAIL
Please mark help full or correct if my answer is use full for you
sachin8d87
Contributor
Contributor

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?

Reply
0 Kudos
RajeevVCP4
Expert
Expert

You can try refresh web-client

To update all data in the current vSphere Web Client view, click the refresh icon (vSphere Web Client refresh icon).

Rajeev Chauhan
VCIX-DCV6.5/VSAN/VXRAIL
Please mark help full or correct if my answer is use full for you
Reply
0 Kudos
sachin8d87
Contributor
Contributor

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?

Reply
0 Kudos
daphnissov
Immortal
Immortal

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.

SoulSherpa
Contributor
Contributor

Hello,

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.

Best regards.

Raj1988
Enthusiast
Enthusiast

Hello ,

It most cases rebooting the ESXi yields the "remove from inventory" option from VC .

https://kb.vmware.com/s/article/1003742

http://blog.vmtraining.net/2017/02/deleting-orphaned-virtual-machine-when.html

https://victorhomocea.wordpress.com/2016/12/13/how-to-delete-orphaned-vms-on-vmware-vcenter-6-5/

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 .

https://yvonneknowsdatabases.com/2017/05/23/remove-vm-from-inventory/

Regards,

AJ

sachin8d87
Contributor
Contributor

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.

Reply
0 Kudos
RickVerstegen
Expert
Expert

You can use PowerCLI using Remove-VM <orphaned VM to delete>

Was I helpful? Give a kudo for appreciation!
Blog: https://rickverstegen84.wordpress.com/
Twitter: https://twitter.com/verstegenrick
Reply
0 Kudos