Export and Import vSphere Replication jobs

Export and Import vSphere Replication jobs

We were needing to migrate all of our host and VMs from vCenter 6.5 to vCenter 6.7 and we wanted to move our current replications from old vSphere Replication appliance to the new appliance after the VMs have moved. I started working on set of workflows which can accomplish this task and wanted to share it with the community as I myself struggled getting the resources and documentation online. Hope it helps someone in the same boat.

 

Current 6.5 environment -

 

2 vCenters in Site 1

1 vCenter in Site 2 (DR)

400 VMs in Site 1 being replicated to Site 2 (DR)

2 vSphere Replication Appliances (1 for each vCenter in Site 1)

1 vSphere Replication Appliance + 2 Add-Ons in Site 2 (DR)

Created a directory in vRO under /mnt called "cifs-share" with 755 privileges

 

Versions -

 

vRealize Orchestrator Appliance 7.3.1

vSphere Replication Appliance 8.2

Source vCenter Server Appliance 6.5 u3 (Before migration)

Destination vCenter Server Appliance 6.7 u3 (After migration)

 

Here are the workflows included in package and some details of what they do -

 

  1. Export Replication Details - This workflow creates a XML file inside vRO appliance which includes details like : VMname, VMid, MpitDetails, RPO, NetworkCompression, Quiescing, Replicated disks, Replication Datastore etc. The workflow gets all current replications and saves this info in the XML file
  2. Pause Replications - This workflow imports the replication details from the XML file and pauses each one of them.
  3. Rename Folders - This workflow gets all current replication details from XML and renames the folder names in remote datastore by appending "-old" at the end so that when we "unconfigure/stop/remove" replications, the underlying data still exists and can act as seeds for later.
  4. Stop Replications - This workflow stops and unconfigures replications on each VM from the XML file.
  5. Rename Folders back - This workflow gets all old replication details from XML and renames all the folders in remote datastore to reflect the original name. Basically takes out the "-old" suffix at the end.

 

NOTE: At this point the migration of VMs and Hosts can be safely performed. Once all VMs and hosts are moved to the new vCenter, unregister all your old vSphere Replication local and remote sites from the vRealize Orchestrator. Add the new vSphere Replication local and remote sites to vRealize Orchestrator and you then have to edit the XML file located in "/mnt/cifs-share/prod_replication_report.xml" with new vSphere Replication remote sitename in each VM entry and new VM ID of the VMs after they got migrated to new vCenters. This can be achieved by a powershell script like this -

 

$newremotesitename = "xyzvcenter"

$cred = Get-Credential

connect-viserver "$newremotesitename" -Credential $Cred

$xml = [xml](Get-Content C:\prod_replication_report.xml)

$xml.SelectNodes("//VM") | % {

    $VM = Get-VM $_.Name

    $_.VMID = $VM.Id.split("-")[1]+"-"+$VM.Id.split("-")[2]

    $_.RemoteSitename = $newremotesitename

}

$xml.Save("C:\prod_replication_report.xml")

Disconnect-VIServer * -Confirm:$false

 

Replace this XML with the one located inside vRO appliance at /mnt/cifs-share/prod_replication_report.xml. You can then continue with the last workflow.

 

     6. Import Replications - This workflow imports all the details from XML and starts setting up replications for each entity and uses the destination disks as seeds.

 

 

P.S. I couldn't find a way to export the number of instances per day detail of the replications in XML, so when importing I had to hard code it to 3, since thats what we used on each replication. You can change this info before running workflow no.6 by editing line 31 and 35 in the script by replacing X to your set value - var numInstances = X;

Attachments
Version history
Revision #:
2 of 2
Last update:
‎04-21-2021 05:00 PM
Updated by:
 
Contributors