At this point, you would check that the virtual machine is in the desired state and then
complete the failover by using this command:
Complete-VMFailover -VMName
The failover is invisible to the virtual machine guest operating system. The operating
system is aware only of a reboot and likely its IP address change, which is performed
by Hyper-V if alternate IP configuration was configured as part of the network adapter
configuration. If you performed a planned failover, the replication is reversed,
provided you selected that option. To fail back so that the virtual machine is running
in the main datacenter, you perform another failover, which will move the virtual
machine back to the main datacenter and then reverse the replication to resume the
normal operation. This is why even on the primary virtual machine, you typically set
its IP configuration in the failover IP section so that when you use Hyper-V Replica to
fail back, the correct IP configuration will be injected back into the virtual machine.
A complication arises for the failback scenario if you are using extended replication
(you have a replica of the replica). The reason for the complication is that if your
configuration indicates that A is replicating to B and then the replication is extended
from B to C (where A, B, and C are Hyper-V hosts), you cannot reverse replication if
you fail over from A to B (so that B would now be replicating to A). This is because B is
already replicating to C, and a single virtual machine cannot have more than one
replica. When performing the initial failover from A to B, you should not select the
option to reverse replication. Once you have performed the failover from A to B, you
do have a choice on server B. You can choose to continue the replication from B to C,
or you can select to replicate from B to A, which will halt the replication to C. In many
instances, you will select the option to continue replication to C, since A is likely not
available. To perform the continued replication, select the Resume Extended
Replication action. You can also use Resume-VMReplication -VMName
Continue to continue using PowerShell. If you do want to replicate to A, you select the
option Reverse Replication, which will break the Hyper-V Replica extended
relationship. The virtual machine on C has now become orphaned. With PowerShell,
you first need to remove the extended replica and then reverse the replication.
Remove-VMReplication –VMName
Set-VMReplication –VMName
Assuming that the option to continue replication from B to C was selected, this makes
the failover of the virtual machine to run on server A a more complex operation
because the virtual machine on server A is no longer receiving updates. The process
involves manually performing the following steps:
1 . Break the replication relationship between B and C.
2 . Set up replication from B to A, which can use the existing virtual machine on
server A, and the resynchronization process will be used to minimize data sent
over the network.