Unable to retrieve Datastore href information for any storage profiles when executing the API call: iaas/api/storage-profiles/id
search cancel

Unable to retrieve Datastore href information for any storage profiles when executing the API call: iaas/api/storage-profiles/id

book

Article ID: 415999

calendar_today

Updated On:

Products

VCF Operations/Automation (formerly VMware Aria Suite)

Issue/Introduction

  • When executing the API : iaas/api/storage-profiles/id, either through action item or as part of a workflow it fails to retrieve the datastore href information.

  • Execution of the action item or workflow fails with below error

    Action '<action_name>' in module '<domain.local>' failed : TypeError: Cannot read property "href" from undefined (domain.local/listStorageProfile#59)

  • Below are the example snippets which includes datastore href information :


    "name": "xxxx-xxxx-xxxxxx-xxxx",
    "id": "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxx",
    "createdAt": "YY-MM-DD",
    "updatedAt": "YY-MM-DD",
    "organizationId": "<OrgID>",
    "orgId": "<OrgID>",
    "_links": {
    "storage-profile-associations":

    { "href": "/iaas/api/storage-profiles/xxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx/storage-profile-associations" }
    ,
    "datastore":

    { "href": "/iaas/api/fabric-vsphere-datastores/xxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx" }
    ,
    "self":

    { "href": "/iaas/api/storage-profiles-vsphere/xxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx" }
    ,
    "region":

    { "href": "/iaas/api/regions/xxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx" }
    }
    },



Environment

Aria Automation 8.18.1

Cause

Starting from vRA version 8.18.1, datastores are maintained in the associations table. Therefore, for storage profiles created on or after 8.18.1, the datastore href is not present in the flat_storage_profile table.

Resolution

In Order to pull the datastore href information Please use the following API : /iaas/api/storage-profiles/{storageItemId}/storage-profile-associations?

Example:

curl -X 'GET' \
  'https://{vRAHost}/iaas/api/storage-profiles/{storageItemId}/storage-profile-associations?apiVersion=2021-07-15&page=0&size=100' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer {token}' 


Response of the above API, returns:

{
  "content": [
    {
      "regionId": "Datacenter:<datacenter_name>",
      "dataStoreId": "<dataStoreId>",
      "storageProfileId": "<storageProfileId>",
      "priority": 1,
      "dataStoreName": "<dataStoreName>",
      "tags": [],
      "id": "/provisioning/resources/storage-profile-association/xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "orgId": "<orgId>",
      "_links": {
        "datastore": {
          "href": "/iaas/api/fabric-vsphere-datastores/xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
        },
        "self": {
          "href": "/iaas/api/storage-profiles/xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/storage-profile-associations"
        },
        "region": {
          "href": "/iaas/api/regions/xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxx"
        }
      }
    }
  ],
  "totalElements": 1,
  "numberOfElements": 1