As you know Microsoft introduced Shared-Nothing Live Migration back in Windows Server 2012 Hyper-V.
For those who are new to this feature, shared-nothing live migration allows an administrator to move a running Virtual Machine from Host A to Host B and optionally it’s storage with just an Ethernet cable without the need to have any shared storage, this is awesome!!!
The requirements for enabling Shared-Nothing Live Migration are fairly simple:
- You need minimum two Server 2012 or 2012 R2 installations with the Hyper-V role enabled or free Microsoft Hyper-V Server 2012/2012 R2 OS.
- Each server must have access to its own location to store VMs. This location can be local or SAN-attached storage or a Server Message Block (SMB) 3.0 share.
- Servers must have the same type or family of processor (Intel or AMD) if you’re using the VM’s Processor Compatibility feature.
- Servers must be part of the same Active Directory domain.
- Servers must be connected by at least a 1Gbps connection (a separate private network for live migration traffic is recommended but not necessary), over which the two servers can communicate.
- Each Hyper-V server should have the same virtual switches defined with the same name, to avoid errors and manual steps when performing the migration, and by leveraging the usage of Ethernet Resource Pool you can live migrate without worry about different virtual switch name.
- VMs that are being migrated must not use pass-through storage.
Let’s assume you meet above requirements, the next step is to enable the Hyper-V hosts for incoming and outgoing live migrations and you are good, but don’t forget the authentication stuff (CredSSP or Kerberos) since we will not cover these here as they are beyond the scope of this post.
More information about Shared-Nothing Live Migration can be found here.
Now if we need to move a VM from host A to host B, how can we accomplish this??? fairly simple using Hyper-V Manager console.
Right click and move…
Shared Nothing Live Migration through PowerShell
The PowerShell cmdlet to move a VM can be considered one of the easiest options on Hyper-V, because the entire process is just one line of command:
Move-VM –Name VM01 –IncludeStorage –DestinationHost HVSRV02 –DestinationStoragePath D:\Hyper-V\
Let’s assume you need to evacuate all Virtual Machines from one host to another as early as possible.
Unfortunately there is no such a way doing this using the UI, you need to select one VM at a time and then move it to the second node.
What about Live Migrating Multiple Virtual Machines Simultaneously?
PowerShell is the answer…
Author: Charbel Nemnom
Date created: 23-December-2013
Last modified: 30-May-2015
Read-host "`nPress [enter] to Start"
[Parameter(Mandatory=$true)] [string] $SourceHostName,
[Parameter(Mandatory=$true)] [string] $DestinationHostName,
[Parameter(Mandatory=$true)] [string] $DestinationStoragePath
$VMNames = Get-VM -ComputerName $SourceHostName | Select VMName
ForEach -Parallel ($VirtualMachine in $VMNames)
Move-VM -Name $VirtualMachine.VMName –ComputerName $SourceHostName –IncludeStorage –DestinationHost $DestinationHostName –DestinationStoragePath $DestinationStoragePath
Read-Host "`nPress enter to Exit"
One important note to mention: when you enable Hyper-V hosts for incoming and outgoing live migrations, the default simultaneous migrations is set to 2 by default, you need to maximize that number to meet your requirements, and there is no one stopping you configuring 100 simultaneous live migrations. When you have only one, two or even four 1Gbps NICs available, but you might stick to 2 or 4 migrations per available 1Gbps, and why limit yourself if you have one or multiple 10Gbps, 40Gbps or even 56Gbps , and sure enough bigger pipes are better than smaller ones but your CEO/CIO will be happy paying more $$$ .
Until then, enjoy your day!