Importing an OVF Package
To import the virtual application OVF template, you follow a few basic steps. The steps are the same for an OVF package that contains a single virtual machines or an OVF package that contains a more complex virtual application.
1
Parse the OVF descriptor by calling OvfManager.parseDescriptor.
2
3
Create the VirtualAppImportSpec by calling OvfManager.createImportSpec.
This structure contains all the information needed to create the entities on the vCenter Server, including children. Clients do not have to read or modify VirtualAppImportSpec to perform basic OVF operations.
4
The method uses a parsed OVF descriptor to create VirtualApp and VirtualMachine objects in the vSphere environment.
The import process itself consists of two steps:
You must wait for the server to create all inventory objects. During object creation, the server monitors the state property on the HttpNfcLease object returned from the ImportVApp call. When the server completes object creation, the server changes the lease to ready state and you can begin uploading virtual disk contents. If an error occurs while the server is creating inventory objects, the lease changes to the error state, and the import process is aborted.
When all inventory objects have been created and the HttpNfcLease has changed to ready state, you can upload disk contents by using the URLs provided in the info property of the HttpNfcLease object. You must call the HttpNfcLeaseProgress method on the lease periodically to keep the lease alive and report progress to the server. Failure to do so causes the lease to time out, aborting the import process.
When you are done uploading disks, complete the lease by calling the HttpNfcLeaseComplete method. You can terminate the import process by calling the HttpNfcLeaseAbort method.
If the import process fails, is terminated, or times out, all created inventory objects are removed, including all virtual disks.