AssociateVms

This method associates one or more virtual machines with a vSphere Replication (VR) protection group. Before you can protect a virtual machine, it must first be associated with a protection group.

Synopsis

void associateVms(vim.VirtualMachine[] vms)

vms[] is an array of Virtual Machine objects to associate with.

Faults

  • InvalidArgument - If the list of virtual machines is empty or null.
  • InvalidState, if a specified VM was already associated with another group.
  • RuntimeFault
  • vim.fault.ConcurrentAccess, if another operation has modified the object and the change version no longer matches.
  • vmodl.fault.NotSupported, if this protection group is not a VR group.

See Faults in Site Recovery Manager API for more details.

Example for AssociateVms

srmPortType.associateVms(
  ManagedObjectReference _this,
  List < ManagedObjectReference > vms);

Where ManagedObjectReference _this = _protectionGroupRef;
where _protectionGroupRef can be taken from:
  SrmServiceInstanceContent content = _srmPortType.retrieveContent(_svcRef);
ManagedObjectReference _protectionRef = content.getProtection();
List < ManagedObjectReference > groups = srmPortType.listProtectionGroups(_protectionRef);
_protectionGroupRef = groups.get(0);