Exporting and Importing a Desired State
Use the vSphere Automation APIs to export the desired software state of a cluster. Then you can import the desired state to a different cluster in the same or a different vCenter Server instance.
Exporting a Desired State
To export a desired state of a cluster, use the
export(cluster_ID,export_spec) method of the
com.vmware.esx.settings.clusters.Software interface. This
method does not export any information about the solutions available on the cluster
since the constraints set by these solutions might not be applicable for another
cluster. Pass as parameters the cluster ID and an
com.vmware.esx.settings.clusters.SoftwareTypes.ExportSpec
instance. You can export a desired software state by using one of the following
options:
- Export an ISO image. Call the setExportIsoImage(exportIsoImage) method of the ExportSpec instance and pass true as an argument. Use the exported ISO image for performing clean installs and for bootstrapping purposes. You can upload the ISO file into the Jetty Web server on the target vCenter Server instance but you cannot use ISO files to manage the life cycle of clusters through the vSphere Lifecycle Manager feature.
- Export an offline bundle in a ZIP file format. Call the getExportOfflineBundle() method of the ExportSpec instance. You can use the exported offline bundle to create a depot and add its components to the resources managed by the Depot Manager module.
- Export a JSON file holding the desired state specification. Call the setExportSoftwareSpec(exportSoftwareSpec) method of the ExportSpec instance and pass true as argument. You can then reuse the JSON file to apply the desired state that it contains to another cluster in the same or in a different vCenter Server instance. Note that the JSON file holds only the description of the desired state. You must check whether all components described in the JSON file are available in the depot for the target cluster. See Importing a Desired State Specification for information about how you can use a desired state specification for another cluster.
Importing a Desired State Specification
To import a desired state of a cluster
and assign it to another cluster in the same or different vCenter
Server instance, use the
importSoftwareSpec(cluster_ID,import_spec) method of the
com.vmware.esx.settings.clusters.software.Drafts interface.
Pass as parameters the cluster ID and a
com.vmware.esx.settings.clusters.software.DraftsTypes.ImportSpec
instance. Use the ImportSpec instance to describe the download
source and the source type of the imported software specification. Depending on the
location and source type of the exported desired state, you can choose from the
following import options:
- Import a file from the vCenter Server or your local file system. Call the setFileId(fileId) method of the ImportSpec instance. Pass as argument the file ID of the software specification which was previously uploaded on the Jetty Web server running on the vCenter Server at https://<vcenter_FQDN>:9087/vum-fileupload URL. You can also use this option to import a specification file that resides on your local file system. Make sure you set the source type of the import specification to SourceType.PUSH through the setSourceType(sourceType) method of the ImportSpec instance.
- Import a file that resides on a URI location. Call the setLocation(location) method of the ImportSpec instance. Pass as argument the URI location of the software specification file. The software specification can be pulled from a URI location with one of the following schemes: file, http, or https. You can use this import mechanism only if you set the source type to SourceType.PULL.
- Import a desired state as a JSON string. Call the setSoftwareSpec(softwareSpec) method of the ImportSpec instance. Pass as argument the JSON string representing the software specification you want to import. Use this mechanism only if you set the source type to SourceType.JSON_STRING.