Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datastore create: ensure targetHypervisorClusterId exists #51

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

stuart-mclaren-hpe
Copy link
Contributor

A change in server behaviour means that a POST request to create a datastore such as:

{
  "name": "mclaren-dsx24",
  "sizeInBytes": 17179869184,
  "storageSystemId": "f9689284-0bbd-5bf1-981f-b9799bbc106c",
  "targetHypervisorClusterId": "",
  "datastoreType": "VMFS"
}

will return a 400 error such as

{
  "debugId": "df4c4f566584ca1fc4511d77fe668f0d",
  "errorCode": "HPE_GL_VIRTUALIZATION_BAD_REQUEST",
  "httpStatusCode": 400,
  "message": "input attributes name, type, sizeInBytes, storageSystemID and targetHypervisorClusterID are mandatory parameters. Error: Key: 'CreateDatastoreVirtRequest.TargetHypervisorClusterID' Error:Field validation for 'TargetHypervisorClusterID' failed on the 'required' tag"
}

To avoid this error, rather than have the system set a default value for targetHypervisorClusterId, we set it expliclity like this:

{
  "name": "mclaren-dsx24",
  "sizeInBytes": 17179869184,
  "storageSystemId": "f9689284-0bbd-5bf1-981f-b9799bbc106c",
  "targetHypervisorClusterId": "ef277a80-6891-534a-9a36-5c7fa67d582a",
  "datastoreType": "VMFS"
}

This requires an additional REST API call to determine the cluster id value based on the name.

A change in server behaviour means that a POST request
to create a datastore such as:

```
{
  "name": "mclaren-dsx24",
  "sizeInBytes": 17179869184,
  "storageSystemId": "f9689284-0bbd-5bf1-981f-b9799bbc106c",
  "targetHypervisorClusterId": "",
  "datastoreType": "VMFS"
}

```

will return a 400 error such as

```
{
  "debugId": "df4c4f566584ca1fc4511d77fe668f0d",
  "errorCode": "HPE_GL_VIRTUALIZATION_BAD_REQUEST",
  "httpStatusCode": 400,
  "message": "input attributes name, type, sizeInBytes, storageSystemID and targetHypervisorClusterID are mandatory parameters. Error: Key: 'CreateDatastoreVirtRequest.TargetHypervisorClusterID' Error:Field validation for 'TargetHypervisorClusterID' failed on the 'required' tag"
}
```

To avoid this error, rather than have the system set a default
value for targetHypervisorClusterId, we set it expliclity like
this:

```
{
  "name": "mclaren-dsx24",
  "sizeInBytes": 17179869184,
  "storageSystemId": "f9689284-0bbd-5bf1-981f-b9799bbc106c",
  "targetHypervisorClusterId": "ef277a80-6891-534a-9a36-5c7fa67d582a",
  "datastoreType": "VMFS"
}
```

This requires an additional REST API call to determine the
cluster id value based on the name.
@stuart-mclaren-hpe stuart-mclaren-hpe merged commit 23ddaf1 into main Nov 12, 2024
5 checks passed
@stuart-mclaren-hpe stuart-mclaren-hpe deleted the datastore-clusterinfo-update branch November 12, 2024 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants