Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

Hyper-V live migration failed, Event ID 21502 "failed at migration source": read the error code that follows

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

Microsoft's live migration page lists a long run of different failures under Event ID 21502, with headings including one about a VM that failed at migration source, one about a missing virtual switch and one about processor features, and the real cause is the text and error code that come with it. This guide matches the code to its cause, shows how to prove it without changing anything, and then fixes that one cause.

What the error means

A live migration moves a running VM between hosts. If a check or a connection fails on the way, Hyper-V logs a failure under Event ID 21502 together with the details of that particular failure. Microsoft's troubleshooting guide for live migration puts the causes in groups: "hardware incompatibility, authentication, network configuration, VM settings, and storage issues".

The words "at migration source" or "at migration destination" in the message tell you which host raised the failure. They do not name the cause. The code in brackets, such as 0x8009030D, does.

Likely causes

Cause What you see How to confirm
Virtual switch missing on the destination "VM failed to live migrate because a virtual switch used by the VM doesn't exist on the destination node" Get-VMSwitch on both hosts: the switch name differs or is absent
Kerberos or delegation not set up "No credentials are available in the security package" (0x8009030E) or "The credentials supplied to the package were not recognized" (0x8009030D) Live migration authentication setting and the host computer accounts' Delegation tab
Migration port blocked or not listening 0x8007274D (connection refused), 0x80072746, 0x8007274C (timed out), 0x8007271D netstat -ano | findstr /I /C:"6600" on both hosts; firewall and antivirus rules
Migration listener disabled "The Virtual Machine Management Service disabled the listener for Virtual Machine migration connections." The event text names the listener, and Registry.pol does not start with the PReg signature (Microsoft's checklist)
Not enough memory on the destination "Failed to create partition: Insufficient system resources exist to complete the requested service. (0x800705AA)" or "could not initialize memory: Ran out of memory (0x8007000E)" Free memory on the destination against the VM's assigned memory
Processor features not supported "The virtual machine uses processor-specific features not supported on the physical computer" Get-VMProcessor and the VM's processor compatibility setting
Configuration version mismatch Migration works one way and not back; events 10698 and 21502 Get-VM * | select Name, Version on both hosts
An ISO attached to the VM "A virtual disk support provider for the specified file was not found." (0xC03A0014) The VM's DVD drive points at an image file
Wrong network chosen for a cross-cluster move "The target principal name is incorrect." (0x80090322) The live migration network order in a cross-cluster move

Prove the cause before changing anything

All of these only read.

1. Read the event details on both hosts. The guide's data collection list names two logs. Run each on the source and the destination:

Get-WinEvent -LogName "Microsoft-Windows-Hyper-V-VMMS/Admin" -MaxEvents 50
Get-WinEvent -LogName Microsoft-Windows-Hyper-V-Worker-Admin -MaxEvents 50

The Get-WinEvent reference documents -LogName and -MaxEvents. Find the 21502 entry and note the whole message and every 0x code. That code decides the next check.

2. Ask Hyper-V whether the VM fits the destination.

Compare-VM -Name web01 -DestinationHost hv02

Microsoft's reference describes Compare-VM as "returning a compatibility report". A good result lists no incompatibilities. A bad result lists them, and they often name a missing switch or a processor feature.

3. Compare virtual switches. Run on both hosts:

Get-VMSwitch

Microsoft's reference says it returns all virtual switches from the local host. Names must match across hosts; the page for event 21502 says "The virtual switch must have the same name on all nodes."

4. Compare configuration versions.

Get-VM * | select Name, Version

5. Check the ports. The checklist says to confirm that TCP ports 6600 and 3343 (the second for clustering) are listening on both sides:

netstat -ano | findstr /I /C:"6600"

6. Check the authentication setup. Read the host's setting, and list its service principal names:

Get-VMHost | Format-List *
setspn -L hv01

The guide names the setspn check and the Delegation tab in Active Directory. In Hyper-V Settings, the Live Migrations page shows the authentication protocol under Advanced Features.

7. Check the Group Policy file. Microsoft's basic checklist, and its item for error 0x8007274C, say to open C:\Windows\System32\GroupPolicy\Machine\Registry.pol in Notepad; the file must start with the PReg signature.

8. Note where the migration was started. The page's text for 0x8009030D says to make sure the operation is initiated on the source host of the migration, or that the source host is configured to use Kerberos with constrained delegation enabled in Active Directory. A migration started from a third machine on a host that uses CredSSP fits that error.

Fix

Fix only the cause the code named. Each change below is for one cause.

Virtual switch missing on the destination

Microsoft's resolution is to open Virtual Switch Manager in Hyper-V Manager on the destination and, if the switch does not exist, create or rename it with the same name and settings as on the other hosts, then confirm the VM's network adapter points at the right switch.

First save the destination's current switch list:

Get-VMSwitch | Format-List * > vmswitch-before-hv02.txt

Risk: the next step creates or renames a virtual switch on hv02, and renaming a switch that VMs already use can interrupt their network connection.

On hv02, in Hyper-V Manager choose Virtual Switch Manager and create or rename the switch so its name and settings match the source's switch, and confirm in the VM's settings that its network adapter points at the right switch. Then use the retry step below.

To undo it: in Virtual Switch Manager, rename the switch back to the name in the saved file, or delete a switch you created that is not in the saved file. Then confirm each VM's network adapter still points at the switch you expect, run Get-VMSwitch and compare with the saved file.

Kerberos or delegation (0x8009030E, 0x8009030D)

The Microsoft page's resolution has three parts: enable Kerberos for live migration on both hosts, set constrained delegation on both host computer accounts (adding cifs and Microsoft Virtual System Migration Service for the other host), and let the old tickets expire (up to 15 minutes) or purge them with KLIST PURGE -li 0x3e7.

First save the current settings of each host:

Get-VMHost | Format-List * > vmhost-before-hv01.txt
setspn -L hv01 > setspn-hv01-before.txt

Also note the option currently selected on each host computer account's Delegation tab in Active Directory Users and Computers.

Risk: the next steps change how live migration authenticates, give each host account the right to present delegated credentials to services on the other host (which widens what those accounts can do in the domain), and, if you run the purge, discard the cached Kerberos tickets of the machine account on that host, which are reissued on demand.

On each host, set Kerberos. The cmdlet reference's example is:

Set-VMHost -VirtualMachineMigrationAuthenticationType Kerberos

Then, in Active Directory Users and Computers, open the host's computer account, choose the Delegation tab, select "Trust this computer for delegation to specified services only" and "Use any authentication protocol", choose Add, pick the other Hyper-V host's computer account, and add cifs and Microsoft Virtual System Migration Service. Repeat for the other host. Wait up to 15 minutes for tickets to expire, or run KLIST PURGE -li 0x3e7 on each host, then use the retry step below.

To undo it: on each host, set the authentication type the saved file shows (the accepted values are CredSSP and Kerberos), and restore each Delegation tab to what you noted.

Set-VMHost -VirtualMachineMigrationAuthenticationType CredSSP

Use that line only if the saved file shows CredSSP for that host. The purge needs no undo, because tickets are reissued.

Retry the migration

First print where web01 runs now:

Get-VM -Name web01

Disruptive step: the next command live-migrates web01 from the host that runs it to hv02. A migration that fails midway can leave the VM paused or on the wrong host, and Microsoft's pages describe no way to cancel one once started. Use a VM that can be restarted for the first attempt, not a production VM.

Microsoft's Move-VM example form, for a VM stored on an SMB share (other storage layouts need the storage parameters on that page):

Move-VM -Name web01 -DestinationHost hv02

To undo it: if web01 arrived and runs on hv02, move it back with the same command from hv02 pointing at hv01, only after the first print and the new Get-VM output confirm which host runs it; if the move failed, run Get-VM -Name web01 on both hosts and leave the VM on the host that runs it.

Move-VM -Name web01 -DestinationHost hv01

The other causes, as Microsoft describes them

  • Blocked ports (0x8007274D, 0x8007271D): check firewall settings and antivirus exclusions, and confirm 6600 and 3343 listen on both sides. The cluster network metrics can be read with Get-ClusterNetwork.
  • Listener disabled: the page's resolution is gpupdate /force; if policy cannot be applied, it says to restore a backup of, or copy, the C:\Windows\System32\GroupPolicy folder from a working server.
  • Memory: the page's resolution for 0x800705AA is to reduce the memory assigned to the VM or turn off some VMs on the destination.
  • ISO attached (0xC03A0014): Microsoft's resolution is for the VM's DVD drive setting to be None.
  • Processor features: the VM's processor setting "Migrate to a physical computer with a different processor version" is the documented fix; see "Migration fails: "the processor is not compatible with the host" (SCVMM 2008 error, Hyper-V fix)".
  • Configuration version: Microsoft's action, Upgrade VM Configuration Version, "can't be rolled back" and the VM then cannot move to older hosts, so it is not scripted here.

Example (illustrative): web01 runs on hv01 and the move to hv02 fails. The VMMS Admin log on hv01 shows Event ID 21502 with "Failed to establish a connection with host "hv02": The credentials supplied to the package were not recognized (0x8009030D)". Get-VMHost on hv01 shows CredSSP, and Compare-VM -Name web01 -DestinationHost hv02 lists no incompatibilities. The engineer saves the settings, sets Kerberos on both hosts, adds delegation for cifs and Microsoft Virtual System Migration Service on each account, purges tickets and runs the retry step on a test VM.

Confirm the fix

  1. Compare-VM -Name web01 -DestinationHost hv02 lists no incompatibilities.
  2. The live migration completes and web01 runs on hv02.
  3. No new Event ID 21502 appears in the VMMS Admin log on either host.
  4. Microsoft notes failures that happen only one way. Treat the reverse direction as its own change, run with the retry step and its warning.

What to watch afterwards

  • Keep virtual switch names, processor settings and configuration versions identical across hosts.
  • Check Get-WinEvent output after patching; the guide lists failures after updates among its known causes.
  • Re-check delegation after a host computer account is rebuilt.

Risks and limits

  • These commands have not been run or lab-tested.
  • Event ID 21502 has more causes than this guide lists. The Microsoft page groups some by Windows Server release and does not give a version range for each.
  • Kerberos delegation changes belong in your normal Active Directory change process.
  • The first attempt after a fix belongs on a VM that can be restarted; move a production VM only once that has worked.

Sources