VMware vSphere

 View Only
Expand all | Collapse all

Is deleting a running virtual machine from vCenter possible?

  • 1.  Is deleting a running virtual machine from vCenter possible?

    Posted Nov 07, 2014 09:09 AM

    Hi all.

    Previously, we had a Horizon View manual pool consisting of VMs
    from a vCenter server. In one VM removal operation in View, we

    erroneously selected the View pool and confirmed the deletion. The

    operation proceeded merrily and when we realized the mistake, we

    found from vSphere client that all the desktop VMs (plenty of they

    were running) in the View manual pool were both deleted from inventory

    and from disk in vCenter server.

    This shocks and confuses us. It is commonly believed that it is
    impossible to delete a running VM from vCenter: vSphere client does
    not give you an option to do so and doing so in MOB ends up failure.
    But the View catastrophe above might suggest the otherwise.

    I have two questions:
    1. Is it possible to delete a running VM from vCenter?
    2. If so, how to prevent it in vCenter?
    3. (a bit off the topic) Is it possible to come up with any hacking or so

       that makes it impossible to delete desktop vm from disk while being

       able to manipulate view pool ? We'd prefer to do that in vCenter instead.

    =====================================
    The mistake we made to delete all Horizon View desktop VMs:
    1. Login onto VMware Horizon View Administrator.
    2. From Inventory select the pool.
    3. In the pool view, select "Inventory" tab.
    4. Select and right click one desktop, Select "Delete Pool..."
    5. Confirm the deletion.

    Software used:
    vCenter Server: 5.5.0, 1945274
    Horizon View: 5.3.1 build-1634134

    Regards,
    Sun Renjie

    Message was edited by: sunrenjie6



  • 2.  RE: Is deleting a running virtual machine from vCenter possible?

    Posted Nov 07, 2014 09:17 AM

    To answer to your first question, You can not delete any vm in power on condition. Can you check if the VM's or VM folders are present in Datastore?

    Thanks,

    DJ



  • 3.  RE: Is deleting a running virtual machine from vCenter possible?

    Posted Nov 07, 2014 09:19 AM

    I am also a bit confuse, Did you delete the VM's or VM pool?



  • 4.  RE: Is deleting a running virtual machine from vCenter possible?

    Posted Nov 07, 2014 01:03 PM

    Hi dishank,

    >>> To answer to your first question, You can not delete any vm in power on condition. Can you check if the VM's or VM folders are present in Datastore?

    Thanks for your reply. Our desktop VMs are deployed in vCenter server as any

    ordinary ones before being added to View pool. So the VMs are present in datastore

    before delete. After the (wrongful) delete of View pool, we checked the datastore,

    and verified that the VMs and folders are gone.

    >>> I am also a bit confuse, Did you delete the VM's or VM pool?

    We intended to remove the VM from View, yet wrongfully removed the View pool

    containing the VM (because the menu entry for removing the VM and for deleting

    the pool containing the VM are together and we were not careful enough and

    clicked the wrong one). The View pool removal effectively deleted all VMs within

    it from the View, and also from vCenter Server inventory, and from the datastore.

    In addition, our View pool is not deployed as manual pool and not via linked clone

    method.

    Any further info are available on request.

    Thanks,

    Sun Renjie



  • 5.  RE: Is deleting a running virtual machine from vCenter possible?

    Posted Nov 07, 2014 09:27 PM

    There might be something really wrong happened here. We have tried to delete a power on VM from API or back end as well, However operation gets executed but always fails with vm power on error.

    Can you please do one experiment, create few dummy VM's(empty VM's with very minimal size). Power it on and try to delete it from VC and let me know the result. Second add them to view pool and again try to delete them form view and see what operations happen on VC. If VM's again get deleted then please provide ESX logs, VC logs and view logs. I will try to see what have gone wrong.

    Now to recover VM's from datastore, there are some tools available to recover it. Please try to use them. also see if this KB helps VMware KB: VMDK Recovery Tool (ESX 3.5 Update 3)



  • 6.  RE: Is deleting a running virtual machine from vCenter possible?

    Posted Nov 07, 2014 09:44 PM

    1. Is it possible to delete a running VM from vCenter?

    Logically its not possible. But practically it is :smileywink:  kind of tricky. Same happened with me in different scenario where i deleted the vm from vcloud and it deleted the powered on vm. which was not acceptabe


    2. If so, how to prevent it in vCenter?

    There must be some editing need to be done on sviconfig .

    3. (a bit off the topic) Is it possible to come up with any hacking or so   that makes it impossible to delete desktop vm from disk while being able to manipulate view pool ? We'd prefer to do that in vCenter instead.

    Hope this can be help out with some tricks.

    VMware KB: Manually deleting linked clones or stale virtual desktop entries from the View Composer database in VMwar…



  • 7.  RE: Is deleting a running virtual machine from vCenter possible?

    Posted Nov 07, 2014 09:57 PM

    1. Is it possible to delete a running VM from vCenter?

    Logically its not possible. But practically it is :smileywink:  kind of tricky. Same happened with me in different scenario where i deleted the vm from vcloud and it deleted the powered on vm. which was not acceptabe

    If it is happening then can you please provide me VC, ESX and VCD or View logs by which you are able to delete power on vm?

    Thanks,

    DJ



  • 8.  RE: Is deleting a running virtual machine from vCenter possible?

    Posted Nov 07, 2014 10:08 PM

    Dishank The UUID attached in the .vmx file of the vm is the reason for the vm to be identical for vCloud. (In my scenario). I made a full clone of the vm to avoid deletion in case the vm got deleted while removing it from vCloud. But due to UUID is the same. its deleted the vm from the vcenter too and it happened in front of my eyes.

    Anyways i find the issue and wrote down an blog for this issue. Migrate VMS from vCloud to vCenter. | Vmwareminds

    I dont have any logs right now. but if i got a chance i will generate the same scenario and share the logs with you.

    But i am damn sure that powered on vm can be delete too.



  • 9.  RE: Is deleting a running virtual machine from vCenter possible?

    Posted Nov 09, 2014 04:26 PM

    @Anjani_kumar I have a lab for VCD, Let me try to see if I can create same scenario.

    Thanks,

    DJ



  • 10.  RE: Is deleting a running virtual machine from vCenter possible?

    Posted Nov 10, 2014 11:10 AM

    vExpert: Anjani Kumar I have created same test bed bud I am unable to find a way to delete power on VM's. Can you please let me know exact stepas what you did to delete vm's?

    Thanks,

    DJ



  • 11.  RE: Is deleting a running virtual machine from vCenter possible?

    Posted Nov 10, 2014 12:33 PM

    Do a clone of your vm in vcenter and make it power on (Name it vm2 or something you can identify).

    Go to the console from where you are managing it. (vCloud or Horizon) . Delete the original vm from there after shutting it down and keep staring at the cloned vm on vmware console. you will see it will be deleted.



  • 12.  RE: Is deleting a running virtual machine from vCenter possible?

    Posted Nov 10, 2014 01:07 PM

    Here it is, What i did,

    I created a vapp with 1 VM in VCD.

    Powered on this vapp.

    In VC, Created a clone of the vm in the vapp.

    Powered on the cloned VM.

    Now powered off the vapp and deleted it.

    I dont see anything happening with cloned VM.

    Can you let me know if I missed anything.

    Thanks,

    DJ



  • 13.  RE: Is deleting a running virtual machine from vCenter possible?

    Posted Nov 09, 2014 03:22 PM

    Hi,

    I am sure normally it is impossible to delete a active VM from vCenter via vSphere client, web client, and MOB.

    But I suspect that Horizon View is using a different, hidden, and more powerful set of API, though I might be wrong.

    Is it possible to check the operations behind the  'Remove pool …'  with the dev guys? :smileywink:

    (I know I'd have to ask at a different place if I choose to talk about Horizon View instead).

    To repeat the catastrophe we experienced:

    1. Install a lab including ESXi, vCenter, Horizon View (preferably with the versions we used), configure appropriately so that they work together, as we normally do.

    2. Create a desktop VM in vCenter, ensure it is working and convert it to a template; then deploy this template to several VMs.

    3. Create a manual pool in Horizon View, add these desktop VMs and ensure they are active and working.

    4. Ensure that vSphere client is connected to vCenter Server and have the VMs displayed at the left panel.

    5. At Horizon View Administrator, select the manual View pool, from inventory select one desktop VM, right click, select 'Remove pool …' and confirm the operation.

    6. You will see that the active VMs disappear one by one from your vSphere client (I personally observed precisely that horror).

    I'd rather not repeat that experiment for the fear of greater catastrophe: our deployment is partially in production.

    I'd post the logs If I am able to collect them.

    Thanks for your reply.

    Cheers,

    Renjie Sun



  • 14.  RE: Is deleting a running virtual machine from vCenter possible?

    Posted Nov 09, 2014 04:29 PM

    sunrenjie6 Let me try to create this lab and get back to you in 2-3 days.

    Thanks,

    Dishank



  • 15.  RE: Is deleting a running virtual machine from vCenter possible?

    Posted Nov 09, 2014 02:56 PM

    Hi Anjani Kumar,

    Thanks very much for reply.

    I'll try that.



  • 16.  RE: Is deleting a running virtual machine from vCenter possible?
    Best Answer

    Posted Dec 01, 2014 08:09 PM

    Hello Sun Renjie,

    Finally I was able to create your issue on my testbed but As I said earlier, it is not possible to delete a power on VM, Which was true. When I have deleted the pool which consists of power on VM's I have seen in the VC that VM's were getting powered off first and getting deleted.

    I also talk to horizon team and they said that this feature is designed in this way to support several other features. To save from accidentally deleting VM's they had introduced the warning message.

    Sorry for your loss.

    Thanks,

    DJ



  • 17.  RE: Is deleting a running virtual machine from vCenter possible?

    Posted Dec 02, 2014 06:44 AM

    Hi dishank,


    That makes sense: View could certainly do power off and deletion together.

    I should have realized that.


    Thank you very much for your effort to test and get the details.

    I'll mark this as solved.

    Sun Renjie