none
Hyper-V Cluster Moves VMs during reboot. Easiest way to move them back to original hosts?

    Question

  • We do not have any System Center products.

    When we reboot Hyper-V hosts for Windows Updates, the guests move to other hosts.  When the old host is back up, we have to find where the hosts went and then manually move them back.

    These updates are done during scheduled down time, so it would be fine if they went offline at that time and we really don't need the guests to move back and forth during scheduled outages.  It would be easier if they just paused and resumed as the host shutdown and restarted, remained where they are and only moved to new hosts if there was an unexpected/unplanned shutdown of the host.

    Is there a better way to do this or to automate moving them back to the original hosts when those hosts finish rebooting?


    Friday, October 19, 2012 8:21 PM

Answers

  • You can create a PowerShell script.  It sounds like you have a fixed list of VMs on each host and would like to keep them balanced that way, so you could create a fairly simplistic script.  Since you are scheduling the shutdown of a node in that cluster, create a PowerShell script that saves the status of each of the VMs running on that node and then reboots the node.  Upon startup, run another PowerShell script to restore the saved VMs.  A separate set of scripts doing the exact same thing would be on the other node of the cluster.

    Or, you could run them from a central management workstation or server. 

    Once you get more comfortable with PowerShell you could write a script that looks at a node, figures out what VMs are on it, save their state, shut down the node, loop until it finds the node back up and restore the VMs, then automatically do the same on the other node.


    tim

    Friday, October 19, 2012 10:30 PM
  • If you are looking at Windows 2008 (r2) then the best advise would be to either look at System Center VMM 2012 and/or even better consider an upgrade of your host cluster to Windows Server 2012. With Windows Server 2012 the manual procedures you described are automated out of the box.

    You can node a node drain. This will live migrate all VMs from a host to other hosts and after the host reboot you can issue a failback of the roles, which will live migrate the VMs back to the Original host.

    But even better, with Cluster Aware Updating (CAU) you have a High Available role with a scheduler that will run the complete update process for you (from your internal WSUS server or directly from Microsoft Update). This great feature comes with Windows Server 2012 at no extra costs!

    More information on node drain can be found here

    A Technet blog on Cluster Aware Updating can be found here

    I hope this answers your question.

    Regards,

    Marc van Eijk

    Friday, October 19, 2012 11:10 PM

All replies

  • You can create a PowerShell script.  It sounds like you have a fixed list of VMs on each host and would like to keep them balanced that way, so you could create a fairly simplistic script.  Since you are scheduling the shutdown of a node in that cluster, create a PowerShell script that saves the status of each of the VMs running on that node and then reboots the node.  Upon startup, run another PowerShell script to restore the saved VMs.  A separate set of scripts doing the exact same thing would be on the other node of the cluster.

    Or, you could run them from a central management workstation or server. 

    Once you get more comfortable with PowerShell you could write a script that looks at a node, figures out what VMs are on it, save their state, shut down the node, loop until it finds the node back up and restore the VMs, then automatically do the same on the other node.


    tim

    Friday, October 19, 2012 10:30 PM
  • If you are looking at Windows 2008 (r2) then the best advise would be to either look at System Center VMM 2012 and/or even better consider an upgrade of your host cluster to Windows Server 2012. With Windows Server 2012 the manual procedures you described are automated out of the box.

    You can node a node drain. This will live migrate all VMs from a host to other hosts and after the host reboot you can issue a failback of the roles, which will live migrate the VMs back to the Original host.

    But even better, with Cluster Aware Updating (CAU) you have a High Available role with a scheduler that will run the complete update process for you (from your internal WSUS server or directly from Microsoft Update). This great feature comes with Windows Server 2012 at no extra costs!

    More information on node drain can be found here

    A Technet blog on Cluster Aware Updating can be found here

    I hope this answers your question.

    Regards,

    Marc van Eijk

    Friday, October 19, 2012 11:10 PM
  • Totally agree that System Center would be the best answer, but the first line of his post is "We do not have any System Center products".  And, if all he has is a single cluster with a few VMs, even though I think System Center is a great suite of products, setting it up is a lot more complex than writing a couple PowerShell scripts.

    tim

    Monday, October 22, 2012 11:55 AM