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.
Prerequisites
- Verify that all general prerequisites and prerequisites for the Cloud Assembly 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
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='c8c3c9bfdb449475-7f703c5265a63d87-5fa34c478df36b060e1ca3551254c4033013bf3283908e4661cd1c6fb2f8b9ae-ce5aad01092b47558644f6b6615d'
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.
- 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", ...
- 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.
- 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", ...
- 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", ...