To create a vSphere storage profile, you make a POST request with a region ID. Optional request body input includes a vSphere storage policy and a vSphere datastore.

As an alternative to using the storage-profiles API call to create a vSphere storage profile, you can also use the storage-profiles-vsphere API call. Optional procedure steps show how to use the storage-profiles-vsphere API call. The example only includes the steps required to create a vSphere storage profile using the storage-profiles API call.

Prerequisites

  • Verify that all general prerequisites and prerequisites for the Automation Assembler Infrastructure as a Service (IaaS) service have been satisfied. See Prerequisites for API Use Case Examples.
  • Verify that you have the cloud account ID for the new cloud account that you added. See Adding Cloud Accounts.

Procedure

  1. Assign the cloud account ID variable.
    vsphere_cloud_account_id='<your_cloud_account_id>'
  2. Look up region IDs associated with the cloud account and in the external region ID Datacenter:datacenter-10.
    curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/regions/?apiVersion=$api_version&"'$filter'"=externalRegionId%20eq%20'Datacenter:datacenter-10'%20and%20cloudAccountId%20eq%20'"$vsphere_cloud_account_id"'"  | jq "."
  3. Examine the response to find the ID for the region that you want.
  4. Assign the region ID variable.
    vsphere_region_id='<your_region_id>'
  5. (Optional) If using a vSphere storage policy, list all vSphere storage policies. If using a default storage policy, skip this step.
    curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/fabric-vsphere-storage-policies/?apiVersion=$api_version" | jq "."
    Examine the response and assign the vSphere storage policy ID.
    vsphere_storage_policy_id='<your_vsphere_storage_policy_id>'
  6. (Optional) If using a vSphere datastore, list all vSphere datastores. If provisioning any datastore or cluster, skip this step.
    curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/fabric-vsphere-datastores/?apiVersion=$api_version" | jq "."
    Examine the response and assign the vSphere datastore ID.
    vsphere_datastore_id='<your_vsphere_datastore_id>'
  7. Create a vSphere storage profile.
    curl -X POST \ 
      $url/iaas/api/storage-profiles?apiVersion=$api_version \ 
      -H 'Content-Type: application/json' \ 
      -H "Authorization: Bearer $access_token" \ 
      -d '{ 
        "name": "<your-vsphere-storage-profile>", 
        "description": "Example vSphere storage profile", 
        "defaultItem": true, 
        "supportsEncryption": true, 
        "tags": [ { "key" : "env", "value": "dev" } ], 
        "diskProperties": { 
          "provisioningType": "thin",
          "independent":"true",
          "persistent":"true", 
          "sharesLevel": "low", 
          "shares": "500", 
          "limitIops": "500" 
        }, 
        "diskTargetProperties": { 
          "storagePolicyId": "'$vsphere_storage_policy_id'", 
          "datastoreId": "'$vsphere_datastore_id'" }, 
          "regionId": "'$vsphere_region_id'" 
        }' | jq "."
  8. To obtain the storage profile ID, examine the response.
  9. Assign the storage profile ID variable.
    vsphere_storage_profile_id='<your_storage_profile_id>'
  10. (Optional) Look up the storage profile you created with your storage profile ID.
    curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/storage-profiles/$vsphere_storage_profile_id?apiVersion=$api_version | jq "."
    The response shows the name and ID for the storage profile you created.
    Note: Using the external region ID and the cloud account ID, you can also filter for the storage profile with a query that does not require the storage profile ID. See Filtering Resources by Region ID.
  11. (Optional) List all storage profiles using the storage-profiles-vsphere API call. API.
    curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/storage-profiles-vsphere?apiVersion=$api_version | jq "."
  12. (Optional) Delete a vSphere storage profile. Alternatively, you can use the storage-profiles-vsphere API call..
    curl -X DELETE -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/storage-profiles/$vsphere_storage_profile_id?apiVersion=$api_version | jq "."

Example: Create vSphere storage profile

Assign the required variables including the cloud account ID for a vSphere cloud account.
$ url='https://appliance.domain.com'
$ api_version='2021-07-15'
$ vsphere_cloud_account_id='515684ccebafde75-7f703c5265a63d87-e78aab87e9c8d5cd4cd1da1a285403f0f4e77a5240720d093e147b830b172542-23b5c527d7083675572f5099a8da0'

Look up region IDs associated with the cloud account and in the external region ID Datacenter:datacenter-10.

$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/regions/?apiVersion=$api_version&"'$filter'"=externalRegionId%20eq%20'Datacenter:datacenter-10'%20and%20cloudAccountId%20eq%20'"$vsphere_cloud_account_id"'" | jq "."

A snippet of the response shows the region ID.

...            
      "externalRegionId": "Datacenter:datacenter-10",
      "cloudAccountId": "c8c3c9bfdb449475-7f703c5265a63d87-809fe6fef311fdd63aa6dac546574aa898213265e988e34cc851db19b8c05b96-f405bb370210c875572d26445252e",
      "id": "cfb7246505319275572d26466a749",
...

Assign the vSphere region ID.

$ vsphere_region_id='cfb7246505319275572d26466a749'

If using a vSphere storage policy, perform the following steps.

  1. List all vSphere storage policies.
    $ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/fabric-vsphere-storage-policies/?apiVersion=$api_version" | jq "."

    A snippet of the response shows the storage policy.

    ...
          "externalId": "f31f2442-8247-4517-87c2-8d69d7a6c696",
          "name": "Management Storage Policy - Stretched",
          "description": "Management Storage policy used for VMC stretched cluster",
          "id": "4aad51f0b02b5275572d264d28490",
    ...
  2. Examine the response to assign the vSphere storage policy ID.
    $ vsphere_storage_policy_id='4aad51f0b02b5275572d264d28490'

If provisioning a specific datastore or cluster, perform the following steps.

  1. List all vSphere datastores.
    $ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/fabric-vsphere-datastores/?apiVersion=$api_version" | jq "."

    A snippet of the response shows the datastore.

    ...
          "externalId": "WorkloadDatastore",
          "name": "WorkloadDatastore",
          "id": "c4f1dd4741d05e75572d264dcc590",
          "createdAt": "2022-04-02",
          "updatedAt": "2022-04-02",
    ...
  2. Examine the response to assign the vSphere datastore ID.
    $ vsphere_datastore_id='c4f1dd4741d05e75572d264dcc590'

Create a vSphere storage profile named vsphere-storage-profile.

$ curl -X POST \
  $url/iaas/api/storage-profiles?apiVersion=$api_version \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $access_token" \
  -d '{
    "name": "vsphere-storage-profile",
    "description": "Example vSphere storage profile",
    "defaultItem": true,
    "supportsEncryption": true,
    "tags": [ { "key" : "env", "value": "dev" } ],
    "diskProperties": {
      "provisioningType": "thin",
      "independent":"true",
      "persistent":"true",
      "sharesLevel": "low",
      "shares": "500",
      "limitIops": "500"
    },
    "diskTargetProperties": {
      "storagePolicyId": "'$vsphere_storage_policy_id'",
      "datastoreId": "'$vsphere_datastore_id'"
    },
    "regionId": "'$vsphere_region_id'"
}' | jq "."

A snippet of the response shows the storage profile ID.

...      
  "externalRegionId": "Datacenter:datacenter-10",
  "name": "vsphere-storage-profile",
  "description": "Example vSphere storage profile",
  "id": "b4fbd25e-a2dd-4fde-9186-0f7bd34a1df2",
  "createdAt": "2022-04-02",
  "updatedAt": "2022-04-02",  
...