Thursday 12 July 2012

Maintenance Mode in Hyper-V 2008 R2 is not what you think it is....

If you have been working with VMware in the past, probably you know what a virtualisation hypervisor should behave when in "maintenance mode" right? meaning the server should be in a state that no virtual machines are allowed to migrate to or have new virtual machines being placed on the server. After working with Hyper-V 2008 R2 for the first time, I made the mistake of "assume" that the maintenace mode is the same in Hyper-V as in VMware, oh boy, was I ever wrong!!!!

We have a hyper-v host that is having some issue with virtual machine networking, so we put it in "maintenance mode" thinking of dealing with it later. The next day, few virtual machines magically migrated to the hyper-v host in maintenance mode and lost network connection!!!! What the £*&^$*?!?!?!?... confused and puzzled, we did some test and tried to manually "live migrate" a vm to the host in Maintenance mode, and we got an error... OK, so it's the system automatically migrate virtual machines to the host.

Did some google search, and also Microsoft verifid that "Hyper-V 2008 R2 maintenance mode is a bit 'funny', here's what you need to do to guarantee no virtual machines gets migrated to a Hyper-V 2008 R2 host:

1) in SCVMM console, right click the host and select "start maintenance mode"
2) in Failover Cluster Manager console, right click on the host and select "Pause"

Turns out, without "pausing" the node in the MS Failover cluster, even though the host is in "maintenance mode" from SCVMM's point of view, it is still part of the Cluster and virtual machine can still be migrated to the host!!!!

So, a word of caution, if you ever decide to do some patching or updating on your Hyper-v host, make sure you also "pause" the node in Failover Cluster manager, to prevent virtual machines being migrate to a hyper-v host that you are doing some patching on....

Microsoft has confirmed that this "feature" has been fixed in SCVMM 2012, so when you do put a host in maintenance mode, it actually automatically "pause" the cluster node so no virtual machine can be migrated to the host... phew.... what a relief.... that's if you continue to use Hyper-v... I've been working with VMware product since 2005 when ESX2.5/GSX is the coolest thing I've seen so I might be a bit biased towards VMware, but the functionality and stability speak for themselves and personally I think Hyper-V 2008 R2 is just not quite on the same level as vSphere. Maybe Hyper-V 3 is better (they better be!), but I have to try it first before I can comment on it. :)

Keep on virtualizing!