{"id":12136,"date":"2012-03-05T11:59:18","date_gmt":"2012-03-05T11:59:18","guid":{"rendered":"https:\/\/aidanfinn.com\/?p=12136"},"modified":"2012-03-05T11:59:18","modified_gmt":"2012-03-05T11:59:18","slug":"windows-server-8-hyper-v-live-migration","status":"publish","type":"post","link":"https:\/\/aidanfinn.com\/?p=12136","title":{"rendered":"Windows Server 2012 Hyper-V Live Migration"},"content":{"rendered":"<p>Live Migration was the big story in Windows Server 2008 R2 Hyper-V RTM and in WS2012 Hyper-V it continues to be a big part of a much BIGGER story. Some of the headline stuff about Live Migration in Windows Server 2012 Hyper-V was announced at Build in September 2012. The big news was that Live Migration was separated from Failover Clustering. This adds flexibility and agility (2 of the big reasons beyond economics why businesses have virtualised) to those who don\u2019t want to or cannot afford clusters:<\/p>\n<ul>\n<li>Small businesses or corporate branch offices where the cost of shared storage can be prohibitive<\/li>\n<li>Hosting companies where every penny spent on infrastructure must be passed onto customers in one way or another, and every time the hosting company spends more than the competition they become less competitive.<\/li>\n<li>Shared pools of VDI VMs don\u2019t always need clustering. Some might find it acceptable if a bunch of pooled VMs go offline if a host crashes, and the user is redirected to another host by the broker.<\/li>\n<\/ul>\n<p>Don\u2019t get me wrong; Clustered Hyper-V hosts are still the British Airways First Class way to travel. It\u2019s just that sometimes the cost is not always justified, even though the SMB 3.0 and Scale Out File Server story brings those costs <em>way<\/em> down in many scenarios where the hardware functions of SAS\/iSCSI\/FC SANs aren\u2019t required.<\/p>\n<p>Live Migration has grown up. In fact, it\u2019s grown up big time. There are lots of pieces and lots of terminology. We\u2019ll explore some of this stuff now. This <em>tiny<\/em> sample of the improvements in Windows Server 2012 Hyper-V shows how much work the Hyper-V group have done in the last few years. And as I\u2019ll show you next, they are not taking any chances.<\/p>\n<p><strong><span style=\"text-decoration: underline;\">Live Migration With No Compromises<\/span><\/strong><\/p>\n<p>Two themes have stood out to me since the Build announcements. The first theme is \u201cthere will be no new features that prevent Hyper-V\u201d. In other words, any developer who has some cool new feature for Microsoft\u2019s virtualisation product must design\/write it in such a way that it allows for uninterrupted Live Migration. You\u2019ll see the evidence of this as you read more about the new features of Windows Server 2012 Hyper-V. Some of the methods they\u2019ve implemented are quite clever.<\/p>\n<p>The second and most important theme is \u201calways have a way back\u201d. Sometimes you want to move a VM from one host to another. There are dependencies such as networking, storage, and destination host availability. The source host has no control over these. If one dependency fails, then the VM cannot be lost, leaving the end users to suffer. For that reason, new features always try to have a fallback plan where the VM can be left running on the source host if the migration fails.<\/p>\n<p>With those two themes in mind, we\u2019ll move on.<\/p>\n<p><strong><span style=\"text-decoration: underline;\">Tests Are Not All They Are Cracked Up To Be<\/span><\/strong><\/p>\n<p>The first time I implemented VMware 3.0 was on a HP blade farm with an EVA 8000. Just like any newbie to this technology (and to be honest I still do this with Hyper-V because it\u2019s a reassuring test of the networking configurations that I have done) I created a VM and did a live migration (vMotion) of a VM from one host to another while doing a Ping test. I was saddened to see 1 missed ping during the migration.<\/p>\n<p>What exactly did I test? Ping is an ICMP tool that is designed to have very little tolerance of faults. Of course there is little to no tolerance; it\u2019s a network diagnostic tool that is used to find faults and packet loss. Just about every application we use (SMB, HTTP, RPC, and so on) are TCP based. TCP (or Transmission Control Protocol) is designed to handle small glitches. So where Ping detects a problem, something like a file copy or streaming media might have a bump in the road that we humans probably won\u2019t perceive. And event applications that use UDP, such as the new RemoteFX in Windows Server 2012, are built to be tolerant of a dropped packet if it should happen (they choose UDP instead of TCP because of this).<\/p>\n<p>Long story, short: Ping is a great test but bear in mind that you have a strong chance of seeing just 1 packet will slightly increased latency or even a single missed ping. The eyeball test with a file copy, an RDP session, or a streaming media session is the real end user test.<\/p>\n<p><strong><span style=\"text-decoration: underline;\">Live Migration \u2013 The Catchall<\/span><\/strong><\/p>\n<p>The term Live Migration is used as a big of a catchall In Windows Server 2012 Hyper-V. To move a VM from one location to another, you\u2019ll start off with a single wizard and then have choices.<\/p>\n<p><strong><span style=\"text-decoration: underline;\">Live Migration \u2013 Move A Running VM<\/span><\/strong><\/p>\n<p>In Windows Server 2008 R2, we had Live Migration built into Failover Clustering. A VM had two components: it\u2019s storage (VHDs usually) and it\u2019s state (processes and memory). Failover Clustering would move responsibility for both the storage and state from one host to another. That still applies in a Windows Server 2012 Hyper-V cluster, and we can still do that. But now, at it\u2019s very core, Live Migration is the movement of the state of a VM \u2026 but we can also move the storage as you\u2019ll see later.<\/p>\n<p>AFAIK, how the state moves hasn\u2019t really changed because it works very well. A VM\u2019s state is it\u2019s configuration (think of it as the specification, such as processor and memory), it\u2019s memory contents, and it\u2019s state (what\u2019s happening now).<\/p>\n<p>The first step is to copy the configuration from the source host to the destination host. Effectively you now have a bank VM sitting on the destination host, waiting for memory and state.<\/p>\n<p><a href=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2012\/03\/clip_image001.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;\" title=\"clip_image001\" src=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2012\/03\/clip_image001_thumb.png\" border=\"0\" alt=\"clip_image001\" width=\"244\" height=\"81\" \/><\/a><\/p>\n<p>Now the memory of the VM is copied, one page at a time from the source host while the VM is running. Naturally, things are happening on the running VM and it\u2019s memory is changing. Any previously copied pages that subsequently change are marked as dirty so that they can be copied over again. Once copied, they are marked as clean.<\/p>\n<p><a href=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2012\/03\/clip_image002.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;\" title=\"clip_image002\" src=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2012\/03\/clip_image002_thumb.png\" border=\"0\" alt=\"clip_image002\" width=\"244\" height=\"95\" \/><\/a><\/p>\n<p>Eventually you get to a point where either everything is copied or there is almost nothing left (I\u2019m simplifying for brevity \u2013 brevity! \u2013 me! \u2013 hah!). At this point, the VM is paused on the source host. Start the stopwatch because now we have \u201cdowntime\u201d. The state, which is tiny, is copied from the source host to the VM in the destination host. The now complete VM on the destination is not complete. It is placed \u201cback\u201d into a running state, and the VM in the source site is removed. Stop the stopwatch. Even in a crude lab, at most I miss is one ping here, and as I stated earlier, that\u2019s not enough to impact applications.<\/p>\n<p><a href=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2012\/03\/clip_image003.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;\" title=\"clip_image003\" src=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2012\/03\/clip_image003_thumb.png\" border=\"0\" alt=\"clip_image003\" width=\"244\" height=\"90\" \/><\/a><\/p>\n<p>And that\u2019s how Live Migration of a running VM works without getting to bogged down in the details.<\/p>\n<p><strong><span style=\"text-decoration: underline;\">Live Migration on a Cluster<\/span><\/strong><\/p>\n<p>The process for Live Migration of a VM is simple enough:<\/p>\n<ul>\n<li>The above process happens to get a VM\u2019s state from the source host to the destination host.<\/li>\n<li>As a part of the switch over, responsibility for the VM\u2019s files on the shared storage is passed from the source host to the destination host.<\/li>\n<\/ul>\n<p>This combined solution is what kept everything pretty simple from our in-front-of-the-console perspective. Things get more complicated with Windows Server 2012 Hyper-V because Live Migration is now possible without a cluster.<\/p>\n<p><strong><span style=\"text-decoration: underline;\">SMB Live Migration<\/span><\/strong><\/p>\n<p>Thanks to SMB 3.0 with it\u2019s multichannel support, and added support for high-end hardware features such as RDMA, we can consider placing a VM\u2019s files on a file share.<\/p>\n<p><a href=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2012\/03\/clip_image004.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;\" title=\"clip_image004\" src=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2012\/03\/clip_image004_thumb.png\" border=\"0\" alt=\"clip_image004\" width=\"117\" height=\"244\" \/><\/a><\/p>\n<p>The VMs continue to run on Hyper-V hosts, but when you inspect the VMs you\u2019ll find their storage paths are on a UNC path such as \\FileServer1VMs or \\FileServerCluster1VMs. The concept here is that you an use a more economic solution to store your VMs on a shared storage solution, with full support for things like Live Migration and VSS backup. I know you\u2019re already questioning this, but by using multiple 1 Gbps or even 10 Gbps NICs with multichannel (SMB 3.0 simultaneously routing file share traffic over multiple NICs without NIC teaming) then you can get some serious throughput.<\/p>\n<p>There are a bunch of different architectures which will make for some great posts at a later point. The Hyper-V hosts (in the bottom of the picture) can be clustered or not clustered.<\/p>\n<p>Back to Live Migration, and this scenario isn\u2019t actually that different to the Failover Cluster model. The storage is shared, with both the source and destination hosts having file share and folder permissions to the VM storage. Live Migration happens, and responsibility for files is swapped. Job done!<\/p>\n<p><strong><span style=\"text-decoration: underline;\">Shared Nothing Live Migration<\/span><\/strong><\/p>\n<p>This is one scenario that I love. I wish I\u2019d had it when I was hosting with Hyper-V in the past. It gives you mobility of VMs across many non-clustered hosts without storage boundaries.<\/p>\n<p>In this situation we have two hosts that are not clustered. There is no shared storage. VMs are storage on internal disk. For example, VM1 could be on the D: drive of HostA, and we want to move it to HostB.<\/p>\n<p>A few things make this move possible:<\/p>\n<ul>\n<li>Live Migration: we can move the running state of the VM from HostA to HostB using what I\u2019ve already discussed above.<\/li>\n<li>Live Storage Migration: Ah &#8211; that\u2019s new! We had Quick Storage Migration in VMM 2008 R2 where we could relocate a VM with a few minutes of downtime. Now we get something new in Hyper-V with zero downtime. Live Storage Migration enables us to relocate the files of a VM. There\u2019s two options: move all the files to a single location, or we can choose to relocate the individual files to different locations (useful if moving to a more complex storage architecture such as Fasttrack).<\/li>\n<\/ul>\n<p>The process of Live Storage Migration is pretty sweet. It\u2019s really the first time MSFT has implemented it, and the funny thing is that they created it while, at the same time, VMware was having their second attempt (to get it right) at vSphere 5.0 Storage vMotion.<\/p>\n<p>Say you want to move a VM\u2019s storage from location A to location B. The first step done is to copy the files.<\/p>\n<p><a href=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2012\/03\/clip_image005.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;\" title=\"clip_image005\" src=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2012\/03\/clip_image005_thumb.png\" border=\"0\" alt=\"clip_image005\" width=\"233\" height=\"244\" \/><\/a><\/p>\n<p>IO operations to the source VHD are obviously continuing because the VM is still running. We cannot just flip the VM over after the copy, and lose recent actions on the source VHD. For this reason, the VHD stack simultaneously writes to both the source and destination VHDs as the copy process is taking place.<\/p>\n<p><a href=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2012\/03\/clip_image006.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;\" title=\"clip_image006\" src=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2012\/03\/clip_image006_thumb.png\" border=\"0\" alt=\"clip_image006\" width=\"227\" height=\"244\" \/><\/a><\/p>\n<p>Once the VHD is successfully copied, the VM can switch IO so it only targets the new storage location. The old storage location is finished with, and the source files are removed. Note that they are only removed <em>after<\/em> Hyper-V knows that they are no longer required. In other words, there is a fall back in case something goes wrong with the Live Storage Migration.<\/p>\n<p>Note that both hosts must be able to authenticate via Kerberos, i.e. domain membership.<\/p>\n<p>Bear this in mind: Live Storage Migration is copying and synchronising a bunch of files, and at least one of them (VHD or VHDX) is going to be quite big. There is no way to escape this fact; there will be disk churn during storage migration. It\u2019s for that reason that I wouldn\u2019t consider doing Storage Migration (and hence Shared Nothing Storage Migration) every 5 minutes. It\u2019s a process that I can use in migration scenarios such as storage upgrade, obsoleting a standalone host, or planned extended standalone host downtime.<\/p>\n<p>Back to the scenario of Live Migration without shared storage. We now have the 2 key components and all that remains is to combine and order them:<\/p>\n<ol>\n<li>Live Storage Migration is used to replicate and <em>mirror<\/em> storage between HostA and HostB. This mirror is kept in place until the entire Shared Nothing Live Migration is completed.<\/li>\n<li>Live Migration copies the VM state from HostA to HostB. If anything goes wrong, the storage of the VM is still on HostA and Hyper-V can fall back without losing anything.<\/li>\n<li>Once the Live Migration is completed, the storage mirror can be broken, and the VM is removed from the source machine, HostA.<\/li>\n<\/ol>\n<p><strong><span style=\"text-decoration: underline;\">Summary<\/span><\/strong><\/p>\n<p>There is a lot of stuff in this post. There are a few things to retain from this post:<\/p>\n<ul>\n<li>Live Migration is a bigger term than it was before. You can do so much more with VM mobility.<\/li>\n<li>Flexibility &amp; agility are huge. I\u2019ve always hated VMware Raw Device Mapping and Hyper-V Passthrough disks. The much bigger VHDX is the way forward (score for Hyper-V!) because<br \/>\nit offers scale and unlimited mobility.<\/li>\n<li>It might read like I\u2019ve talked about a lot of technologies that make migration complex. Most of this stuff is under the covers and is revealed through a simple wizard. You simply want to move\/migrate a VM, and then you have choices based on your environment.<\/li>\n<li>You will want to upgrade to Windows Server 2012 Hyper-V.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<div id=\"scid:0767317B-992E-4b12-91E0-4F059A8CECA8:aa200a6e-3846-460e-a781-508d92caf8a0\" class=\"wlWriterEditableSmartContent\" style=\"margin: 0px; display: inline; float: none; padding: 0px;\">Technorati Tags: <a rel=\"tag\" href=\"http:\/\/technorati.com\/tags\/Windows+Server+2012\">Windows Server 2012<\/a>,<a rel=\"tag\" href=\"http:\/\/technorati.com\/tags\/Hyper-V\">Hyper-V<\/a>,<a rel=\"tag\" href=\"http:\/\/technorati.com\/tags\/Virtualisation\">Virtualisation<\/a><\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Live Migration was the big story in Windows Server 2008 R2 Hyper-V RTM and in WS2012 Hyper-V it continues to be a big part of a much BIGGER story. Some of the headline stuff about Live Migration in Windows Server 2012 Hyper-V was announced at Build in September 2012. The big news was that Live &hellip; <a href=\"https:\/\/aidanfinn.com\/?p=12136\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Windows Server 2012 Hyper-V Live Migration&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[20],"tags":[181,195,118],"class_list":["post-12136","post","type-post","status-publish","format-standard","hentry","category-hyper-v","tag-hyper-v","tag-virtualisation","tag-windows-server-2012"],"aioseo_notices":[],"jetpack_featured_media_url":"","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts\/12136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12136"}],"version-history":[{"count":0,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts\/12136\/revisions"}],"wp:attachment":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}