Exporting and Importing a Desired StateLast Updated December 16, 2024
Use the
vSphere
Automation
REST
API to export the desired software state of a cluster or a standalone host. Then you can import the desired state to a different cluster or host in the same or a differentvCenter
Server
instance. Exporting a Desired State
To export a desired state, you can use one of the following methods:
- For a cluster,use the.POST https://request<vcenter_ip_address_or_fqdn>/api/esx/settings/clusters/<cluster_id>/software?action=export
- For a standalone host,use the.POST https://request<vcenter_ip_address_or_fqdn>/api/esx/settings/hosts/<host_id>/software?action=export
Submit the cluster or the standalone host ID, and a
. Software.ExportSpec
JSON object in the request bodyYou can choose how to export the desired software specification.
- Export as an ISO image.SetUse 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 targettrueto theexport_iso_imageproperty of theSoftware.ExportSpecJSON object that you submit in the request body.vCenter Serverinstance but you cannot use ISO files to manage the life cycle of clusters or a standalone host through thevSphere Lifecycle Managerfeature.
- Export as an offline bundle in a ZIP file format.SetYou can use the exported offline bundle to create a depot and add its components to the resources managed by the Depot Manager module.trueto theexport_offline_bundleproperty of theSoftware.ExportSpecJSON object that you submit in the request body.
- Export as a JSON file holding the desired state specification.SetYou can then reuse the JSON file to apply the desired state that it contains to another cluster or standalone host in the same or in a differenttrueto theexport_software_specproperty of theSoftware.ExportSpecJSON object that you submit to the request body.vCenter Serverinstance. 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 or standalone host.
Importing a Desired State Specification
To import a desired state of a cluster or a standalone host and assign it to another cluster or standalone host in the same or different
vCenter
Server
instance:
- For a cluster,use the.POST https://request<vcenter_ip_address_or_fqdn>/api/esx/settings/clusters/<cluster_id>/software/drafts?action=import-software-spec
- For a standalone host,use the.POST https://request<vcenter_ip_address_or_fqdn>/api/esx/settings/hosts/<host_id>/software/drafts?action=import-software-spec
Submit as pat parameters the cluster or the standalone host ID, and a
Use the instance of the import specification to describe the download source and the source type of the imported software specification. Depending on the location and the source type of the exported desired state, you can choose from the following import options:
Drafts.ImportSpec
JSON object in the request body. - Import a file from thevCenter Serveror your local file system.Use theYou 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 tofile_idproperty of theDrafts.ImportSpecdata structure to set the file ID of the software specification which was previously uploaded on the Jetty Web server running on thevCenter Serverathttps://URL.<vcenter_FQDN>:9087/vum-fileuploadPUSHthrough the.source_typeproperty of theDrafts.ImportSpecdata structure
- Import a file that resides on a URI location.Use the.locationproperty of theDrafts.ImportSpecdata structure to submit 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, orhttps. You can use this import mechanism only if you set thesource_typeproperty toPULL
- Import a desired state as a JSON string.Use thesoftware_specproperty of theDrafts.ImportSpecdata structure to set the JSON string representing the software specification you want to import. Use this method only if you set thesource_typeproperty toJSON_STRING.