Hi community!
I've been tasked with mass-configuring replication of our critical VMs to our DR site using vSphere Replication.
Since there is no way I'm going to do this for ~250 VMs, I was wondering if anyone has written a workflow like this in vRO.
We are currently using vRO 7.4 so I'm a bit limited with what I can do on my own...
I managed to use the vSphere Replication plug-in to configure replication for a single VM that I manually choose, but don't know how to do this for a list of VMs (that I already have on the side).
[Next I would need to add the VM to a Protection Group, still investigating it.]
Any help would be much appreciated!
Thanks!
It may help others to know you've already asked about PowerCLI as a solution in another thread: Configure vSphere Replication (+ SRM) for VMs with PowerCLI
Yes Scott,
Unfortunately, it seems I had no luck solving this using PowerCLI, which would have been my preference.
Update: I managed to create a workflow that-
a. Gets a single VM and check if it has vSphere Replication configured
b. If it does, quits; if not, configures it
c. Adds the VM to a fixed Protection Group
d. Configures protection for the VM
This is exactly what I need, but in mass (250 VMs).
Having trouble working out how to use a Resource Element to create an Array of VMs and then running it through a ForEach loop.
Would appreciate some help
Hi there!
Could you tell me how you managed to do that part below?
a. Gets a single VM and check if it has vSphere Replication configured
I need to do something similar. Check which VMs has replication configured through POWERCLI but so far I haven´t found anything related.
Thanks a lot!
You'll probably run into pain using a ResourceElement to store inventory object references. I would recommend using a CSV text file uploaded to the ResourceElement instead. Then you could use the following to load & process that list
// Assume ResourceElement contains the CSV list of VM names to be checked
var csvList = myResourceElement.getContentAsMimeAttachment().content;
// convert the CSV string to a string array of VM names
var vmNamesList = csvList.split(",");
// now loop over SRM Managed VM names
for each(var vmName in vmNamesList)
{
var mySRMVM = findVMByName(vmName);
if(mySRMVM != null)
{
// Found the VM object.....
// Put your SRM checks etc here
}
else
{
// Just in case one is missing
System.log("WARNING!! - SRM Protected VM " + vmName + " could not be found in inventory!!");
}
}
function findVMByName(myVMName)
{
var foundVMs = VcPlugin.getAllVirtualMachines(null, "xpath:@name[starts-with(.,'" + myVMName + "')]");
if(foundVMs != null) // should only be one but the quert returns an array
{
return foundVMs[0];
}
return null;
}
-HTH