Call the VirtualApp.ExportVapp method to obtain an export lease on the
VirtualApp object. The export lease contains a list of URLs for the disks of the virtual machines in the
VirtualApp object, as well as a ticket that gives access to these URLs.
The method returns a HttpNfcLease managed object reference. You can retrieve information about the state and, later, the content of the lease from this managed object reference.
While the lease is held, the virtual machines in the VirtualApp object are locked. Locked virtual machines cannot be powered on, deleted, or undergo any other state change that would disrupt the export process.
When the lease is ready, the HttpNfcLeaseInfo.deviceUrl property is an array of
HttpNfcLeaseDeviceUrl data object. Each object provides a mapping from logical device IDs to upload and download URLs. The URLs that are returned from the lease objects are used to directly post or get the virtual disks. The virtual disks must be stream-optimized VMDK format. This format is described in the virtual disk format specification available at (
http://www.vmware.com/technical-resources/interfaces/vmdk.html).
While downloading each disk, you can create a filename for the resulting disk file. You should choose a name based on the corresponding key of the device URL of the lease (
HttpNfcLease.info.deviceURL.key). OVF Descriptor generation requires the key.
The client must periodically call the HttpNfcLeaseProgress method on the export lease to prevent the lease from expiring.
You can call the HttpNfcLeaseAbort method to terminate the lease. Calling the method releases the lock on the virtual application.
During the last step of the export process, you generate an OVF descriptor by calling the OvfManger.createDescriptor method. You must specify the name and size of each file in the download. Use the
CreateDescriptorParams.ovfFiles array to describe the files. If this array is left empty, placeholders are inserted into the OVF descriptor and the client is responsible for updating the placeholders.
By creating the descriptor, you provide information about the disk files downloaded by the client, both the filenames chosen and the sizes observed, to the server. The server does have that information due to compression during download.
After generating the OVF descriptor, call HttpNfcLease.HttpNfcLeaseComplete to update task information and release the lock on the virtual application.