Aria Automation: Storage Profile API "PATCH /iaas/api/storage-profiles-vsphere/" not working for adding datastores
search cancel

Aria Automation: Storage Profile API "PATCH /iaas/api/storage-profiles-vsphere/" not working for adding datastores

book

Article ID: 422938

calendar_today

Updated On:

Products

VCF Automation

Issue/Introduction

  • Trying to add a datastore to an existing storage profile via the Aria Automation API (PATCH "/iaas/api/storage-profiles-vsphere/<storage-profile-id>")
  • The API call fails with a 400 Bad Request error or removes datastores which were already attached

Environment

VMware Aria Automation 8.x

Resolution

First of all, ensure you are upgraded to 8.18.1-patch3

 

API Instructions:

Use the PATCH /iaas/api/storage-profiles/{id}/storage-profile-associations API call to change datastores.

You do not need to provide the existing datastore IDs, only the extra one I wanted to add:

PATCH /iaas/api/storage-profiles/{id}/storage-profile-associations
{
  "regionId": "<UUID-after-/iaas/api/regions/>",
  "storageProfileAssociations": [
    {
      "requestType": "CREATE",
      "associations": [
        {
          "dataStoreId": "<new-DS-UUID>",
          "priority": "3"
        }
      ]
    }
  ]
}

Note the regionId is not like "Datacenter:datacenter-2": this would give a 404.

Removing datastores can be achieved by changing CREATE to DELETE.