PowerCLI

 View Only
Expand all | Collapse all

How to vmotion virtual machines from disconnected hosts?

  • 1.  How to vmotion virtual machines from disconnected hosts?

    Posted Dec 26, 2013 09:52 AM

    Hi,

    In virtual environment, there are alot of reasons to make the ESX hosts disconnect from vSphere management, still pingable and the virtual machines are staying in. Those VMs have disconnected status also and we can not do any actions from vSphere to them, although Guest OS in VMs are still running. Dont want to discuss about the disconnected reasons, my question is: How to vmotion change host the virtual machines from the disconnected hosts to other hosts safety? Can powershell+powerCLI do that? If not, please give me some recommends how to do, the gold is minimum virtual machine downtime.

    Thanks./.



  • 2.  RE: How to vmotion virtual machines from disconnected hosts?

    Posted Dec 26, 2013 10:35 AM

    You could consider exporting the VM(s) to an OVF file, which is portable.

    When you can get the OVF file to the other ESXi host, you can then import the VM(s) there.

    This is available in the vSphere client under <File><Export>.

    See also the OVF Tool.

    You can call the OVF Tool from within a PowerCLI script, see OVFTool from within PowerCLI



  • 3.  RE: How to vmotion virtual machines from disconnected hosts?

    Posted Dec 26, 2013 11:23 AM

    Hi LucD,

    Thank you for your very fast reply!
    Sorry for my bad english, it make my explanations are not clear. My "migrate" word means vMotion action. My scenario is:

    There is a cluster with two esxi hosts, host A and host B. The VM1 is running on the host A. Suddenly, host A come down to disconnected status, and bring VM1 come down to disconnected status also. We can still ping to both, esxi host and VM1. VM1 is still running normally. Now, I need to reboot host A to fix error (don't discuss about why reboot to fix) and I want to vmotion VM1 to host B safety before reboot host A from console. And my question is: how to do this vmotion VM1 from disconnected host A to host B without shutdown guest OS of VM1?

    That case vSphere can not do anything, so I wonder that script (powershell / powerCLI) can help? Or any actions can I do to minimize VM1 downtime before reboot the host A?

    Thank you./.



  • 4.  RE: How to vmotion virtual machines from disconnected hosts?

    Posted Dec 26, 2013 12:22 PM

    I see, is there shared storage between host A and B ?

    If yes, it would be enough to

    • stop the VM on host A
    • start the VM on host B

    If not,you do seem to have connectivity to host A and B from your station. Is that correct ?

    Then you could do something similar to what William described in his How to Copy VMs Directly Between ESXi Hosts Without Shared Storage post.

    If that is not the case either, then you will have to use a "middle man", to copy the VM's files from the datastore on host A to the datastore on host B.

    Like I said earlier, that can be done with the OVF Tool.



  • 5.  RE: How to vmotion virtual machines from disconnected hosts?

    Posted Dec 26, 2013 01:01 PM

    Oh yes, sorry for lost information, host A and host B are shared storage.

    Arcording to you, first stop VM1 on host A and then start it on host B? So, how to stop VM1 on host A if I can not connect to that host? And how to start VM1 on host B? Do I have to re-add inventory VM1 to host B?

    Otherwise, if stop VM1 on host A it means VM1 fully shutdown and downtime. Do we have the way "vmotion" VM1 between two hosts without downtime similar vsphere action? Or tools?

    Thanks you./.



  • 6.  RE: How to vmotion virtual machines from disconnected hosts?

    Posted Dec 26, 2013 01:35 PM

    If the host is disconnected from vCenter Server, you won't have any options to do actions like vMotion, which basically means you will have downtime unless you are able to resolve the disconnection issue online. If you cannot resolve the issue, you may do a clean shutdown of the VM from within the OS itself. After shutdown further options depend upon whether you can still connect to the host directly. In any case, if you somehow unregister the VM and re-register it, you may need to ensure that other applications which rely on the VM's ID (e.g. image based backup applications) are aware of the VM's new ID.

    André



  • 7.  RE: How to vmotion virtual machines from disconnected hosts?

    Posted Dec 26, 2013 02:04 PM

    well, It's clear for me now. Thank Andre.

    On the same occasion I want to ask another issue to you that our esxi hosts rescan all hba cards and vmfs datastores quite slowly. It take about 5min average and sometime cause disconnect host from vCenter Server. I don't have any RDM harddisks. So how to troubleshoot this issue? My esxi version is 5.0 update 1.



  • 8.  RE: How to vmotion virtual machines from disconnected hosts?

    Posted Dec 26, 2013 02:13 PM

    There could be several reasons for this. I'd start troubleshooting by checking the vmkernel logs for issues while the rescan is in progress. If you have access to the host's console, you can press ALT-F12 for the logs to see what's going on.

    André



  • 9.  RE: How to vmotion virtual machines from disconnected hosts?

    Posted Dec 27, 2013 04:34 PM

    Long rescans can occur if you have a lot of hosts presented to a lot of luns.  Depends how you are designed.



  • 10.  RE: How to vmotion virtual machines from disconnected hosts?

    Posted Dec 26, 2013 03:04 PM

    Can't you do a Connect-VIServer directly to host A instead of the vCenter ?



  • 11.  RE: How to vmotion virtual machines from disconnected hosts?

    Posted Dec 26, 2013 03:13 PM

    Hi LucD,

    No, I can not connect-viserver to esxi host directly. I only can SSH to that host.



  • 12.  RE: How to vmotion virtual machines from disconnected hosts?

    Posted Dec 26, 2013 03:42 PM

    Strange, so SSH is enabled, but you don't allow port 902 to the ESXi server ?

    Then I agree with Andre, instead of trying to find an alternative for a vMotion, you better invest your energy in finding out why the host disconnects, and fix that.