Hyper-V replication sometimes causes problems. What I'm usually doing in this case is to remove and re-enable replication for a VM, and that solves the problem.
Have customers with Hyper-V Clusters. VM replicas are performed to the replica broker role on a target clusters. When a VM has replication errors, I remove replication from the VM and remove the replicated VM on the target cluster. But since some time, re-enabling replication fails with errors "file in use" or "vm is not in the current state to accept replication".
Despite we have disabled replication and deleted the replicated VM on the target cluster, the XML file from the replicated VM is still in c:\clusterstorage\volume1\Hyper-V Replica\virtual machines\<vm-guid>.xml. It's not possible to delete this file, even when stopping the "Hyper-V Virtual Machine Management" Service on the cluster node that owns the CSV. The only "drastic solution" that works is to put the CSV into maintenance mode, add then a drive letter to the disk, and then delete the <vm-guid>.xml file. Then, after taking the CSV out of maintenance mode, replication of the problem VM can be re-enabled successfully.
What is the right way to completely remove a VM replication? How can this problem beeing solved without taking the CSV offline? Thank you in advance for any help.
Franz