How to Import and Export OVF Packages
April 7th, 2010
32 comments
This article is based on a similar one at vSphere Java API home page. At that time, one of VMware community members sent me an email for samples of using OvfManager APIs. Then I went to office on a Saturday writing two samples, which have been validated by several folks as “working” samples.
The purpose of the samples are to illustrate the vSphere APIs. Let’s take a look at them one by one.
First, ExportOvfToLocal.java. This sample shows how to download either a VM or vApp to your local machine. The typical flow is:
- Find the VM or vApp
- Call their exportVm() or exportVApp() methods and get HttpNfcLease
- Set lease time out
- Wait for HttpNfcLease until it’s ready
- From the HttpNfcLease.info property, find the all URLs from which you download the vmdk files
- Call OvfManager.createDescriptor() API to create the content of ovf and save it to a file along with downloaded vmdk files.
- Release the lease by calling httpNfcLeaseComplete() method
Recent Comments