Rapid Cloning Utility v3.0 API Examples

by dlamotta Former NetApp Employee on ‎2010-04-09 05:34 AM

The Rapid Cloning Utility (RCU) Application Programming Interface (API) was released with RCU version 2.1.  The API is exposed using Simple Object Access Protocol (SOAP).  This API can be thought of as a 'higher level' API which makes use of the NetApp Controller API (know as the Manage ONTAP SDK) and the VMware Virtual Center API (known as the VMware vSphere Web Services SDK).  Neither additional API is required for an application or script to consume the RCU API.

The RCU API is designed to be leveraged with the VMware vSphere Web Services SDK to offload the intricacies of storage object cloning while cloning virtual machines. To this end, the managed object reference returned by the VMware vSphere Web Services SDK is used to identify components in the vCenter Inventory. You can view this information using the Managed Object Browser on the vCenter server.

The documentation for the RCU API is found in Appendix C of the Rapid Cloning Utility 3.0 Installation and Administration Guide.  The purpose of this document is to provide some examples written in java, which can be found below in the RCU-3.0-Java-Examples.zip file.  Also included in the file is a package called com.netapp.rcu.api.  This package was generated using the wsimport tool which is included in Java 6.  An example syntax for generating this package is in Appendix C of the 'Installation and Administration Guide'.

Java

The java examples leverage a class named RcuUtil.java.  The purpose of this class is to bypass java security normally required for https.  This should only be use in development and possibly test.  There are steps outlined in Appendix C of the Rapid Cloning Utility 3.0 Installation and Administration Guide for configuring the java application to work with the self signed certificate used in the RCU service.  Information here and the tool posted here may be helpful.

The following examples are provided.  A brief description follows each.

CreateNewNFSDatastore.java

This example shows how to create a new NFS-based datastore.  The controller that the apiNFSTest datastore will be created on is 10.61.167.51. The gold volume will be named apiDemo and created in the aggregate named aggr1. The datastore will be 200GB in size, will be thin provisioned, and will grow in increments of 10GB as needed to a maximum size of 400GB.  The destination for the datastore is the datacenter named "MFIT (64-bit)".

CreateNewVMFSDatastore.java

This example shows how to create a new VMFS-based datastore.  The controller that the apiVMFSTest datastore will be created on is 10.61.167.51.  The new VMFS datastores (lun) will be named unitTestLuns.  It will be 1GB in size and accessed via ISCSI.  The destination for these new clones is the datacenter named "MFIT (64-bit)".

CreateVmsInNewNFS.java

This example shows how to clone a VM into a new NFS-based datastore.  The vm named perlDemo (what's in a name?) will be cloned 3 times.  The new clone names will be curly, larry, and moe.  The controller that the new datastore should be created on is 10.61.167.51. The new NFS datastore will be named apiDemo, will be 200GB in size, will be thin provisioned, and will grow in increments of 10GB as needed to a maximum size of 400GB.  The destination for these new clones is the datacenter named MFIT1.

CreateVmsInNewNFSDatastore.java

This example shows how to clone a VM into new NFS-based datastores.  The vm named javaDemo will be cloned 6 times.  The new clone names will be fred, daphne, velma, shaggy, scooby, and scrappy.  The controller that the new datastores should be created on is 10.61.167.51. The gold volume will be named apiDemo and created in the aggregate named aggr1.  The new NFS datastores (flexclones of apiDemo) will be named mysteryMachine, spookyHouse, and spookyMine.  Each will be 200GB in size, will be thin provisioned, and will grow in increments of 10GB as needed to a maximum size of 400GB.  The destination for these new clones is the datacenter named MFIT2.  Please note the number of vm clones must be evenly divisible by the number of datastores.  In this example we've requested 6 vms and 3 datastores.  This will result in 2 vms per datastore.

CreateVmsInNewVMFSDatastore.java

This example shows how to clone a VM into new VMFS-based datastores.  The vm named javaDemo will be cloned 6 times.  The new clone names will be fred, daphne, velma, shaggy, scooby, and scrappy.  The controller that the new datastores should be created on is 10.61.167.51. The new luns will be created in the existing volume named vmLuns.  The new VMFS datastores (luns) will be named mysteryMachine, spookyHouse, and spookyMine.  Each will be 200GB in size, thin provisioned and accessed via ISCSI.  The destination for these new clones is the datacenter named MFIT2.  Please note the number of vm clones must be evenly divisible by the number of datastores.  In this example we've requested 6 vms and 3 datastores.  This will result in 2 vms per datastore.

CreateVmsWithDefaults.java

This example shows how to clone VMs in an existing datastore.  The vm named apiDemo will be cloned 3 times.  The new clone names will be apCurly, apiLarry, and apiMoe.  The code shows how the new vm named apCurly can be powered on after cloning.  The controller that provides this datastore is 10.61.167.51. The destination for these new clones is the datacenter named MFIT1.

CreateVmsWithSession.java

This example shows how to clone VMs in an existing datastore, using an existing vCenter session ID.  In other words, the example shows a way a user with privileges can establish a vCenter session, and then provide the session ID to a user with less privileges so that the clones can be created.  In this example, 4 clones of the Demo vm are created:  apiCurly, apiLarry, apiMoe, and apiShemp.  The controller that provides the datastore is 10.61.167.51. The destination for these new clones is the datacenter named MFIT1.

DestroyDatastore.java

This example shows how to destroy a datastore in order to free up space.  The datastore that will be destroyed is called apiNFSTest01.  The controller that provides this datastore is 10.61.167.51.

Offload.java

This example shows how to offload the copy of an NFS datastore file within the same controller.  The vm file "[demOs] ericWin2KTest/ericWin2KTest-flat.vmdk" will be copied to "[demOs] ericWin2KTest/apiCloneEricWin2KTest-flat.vmdk"

ReDeployWithDefaults.java

This example shows how to redeploy existing clone VMs in an existing datastore. All clones in the apiDemo vm will be redeployed.  The controller that provides the datastore is 10.61.167.51.

ResizeNFSDatastore.java

This example shows how to resize an NFS datastore.  The unitTestVmClonerNewNFS datastore will be resized to 30GB.  The controller that provides this datastore is 10.61.167.50.

Perl

As a convenience, George Costea ported the create/resize/destroy datastore examples to Perl.

Comments

Could you please give us the perl examples for netapp vsc plugin ? your help will be highly appreciated.

costea Former NetApp Employee

The only thing you have to change is the url to the service.  This is documented in the IAG for VSC.  The required changes are found below.

my $serviceHost = "localhost";

my $rcuService = SOAP::Lite->service("https://$serviceHost:8143/kamino/public/api?wsdl");

Warning!

This NetApp Community is public and open website that is indexed by search engines such as Google. Participation in the NetApp Community is voluntary. All content posted on the NetApp Community is publicly viewable and available. This includes the rich text editor which is not encrypted for https.

In accordance to our Code of Conduct and Community Terms of Use DO NOT post or attach the following:

  • Software files (compressed or uncompressed)
  • Files that require an End User License Agreement (EULA)
  • Confidential information
  • Personal data you do not want publicly available
  • Another’s personally identifiable information
  • Copyrighted materials without the permission of the copyright owner

Files and content that do not abide by the Community Terms of Use or Code of Conduct will be removed. Continued non-compliance may result in NetApp Community account restrictions or termination.