Unprotectvms; Gettasks; Iscomplete - VMware VC-SRM4-A - vCenter Site Recovery Manager Developer's Manual

Site recovery manager api
Table of Contents

Advertisement

Before you can protect a virtual machine, the VirtualMachine's folder, resource pool, and network must be 
mapped from the protected site to the recovery site. To verify, you can use the ListInventoryMappings method 
to get a list of currently configured mappings.
Example 3-12. Method to protect virtual machines
SrmProtectionTaskRef = _service.ProtectVms(_svcRef, vm[] );
Parameters and return value:
_svcRef – managed object reference to an SrmProtectionGroup object
vm[] – an array of managed object references to the VirtualMachine objects for protection
SrmProtectionTaskRef – the task object to monitor status of the request

UnprotectVms

This method removes virtual machines from their protection group. With array based replication, the 
protection group is determined by datastore location of the virtual machines. With vSphere replication (VR), 
you must also UnassociateVms from the protection group.
Example 3-13. Method to unprotect virtual machines
SrmProtectionTaskRef = _service.UnprotectVms(_svcRef, vm[] );
Parameters and return value:
_svcRef – managed object reference to an SrmProtectionGroup object
vm[] – an array of managed object references to the VirtualMachine objects for unprotection
SrmProtectionTaskRef – the task object to monitor status of the request

GetTasks

This method retrieves the task information from vCenter Server after a ProtectVms or UnprotectVms request, 
which take some time to complete.
Example 3-14. Method to get protection tasks
SrmProtectionTaskVmTask[] = _service.GetTasks(_svcRef);
Parameters and return value:
_svcRef – managed object reference to an SrmProtectionTask object
SrmProtectionTaskVmTask[] – Array of monitorable task information objects, each containing:
task – managed object reference to a task on the SRM server
vm – managed object reference to a VirtualMachine

IsComplete

This method checks whether the protection task has completed.
Example 3-15. Method to check protection task
isDone = _service.IsComplete(_svcRef);
Parameters and return value:
_svcRef – managed object reference to an SrmProtectionTask object
VMware, Inc.
Chapter 3 Logical Order API Usage
23

Advertisement

Table of Contents
loading

This manual is also suitable for:

Vcenter site recovery manager 5.0

Table of Contents