-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Datastore create: ensure targetHypervisorClusterId exists
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.
- Loading branch information
1 parent
da1477c
commit 23ddaf1
Showing
4 changed files
with
104 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
internal/simulator/fixtures/datastores/create/hypervisorclustersfiltered.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{"items": [{"appInfo":{"vmware":{"datacenterInfo":{"displayName":"","id":"7d8051ab-4224-5075-93be-c1c0fa645e7d","moref":"datacenter-3","name":"5305-DC"},"moref":"domain-c19"}},"clusterPerfMetricInfo":{"cpuCapacityInMhz":0,"cpuUsageInMhz":0,"memorySizeInBytes":0,"memoryUsageInMb":0,"totalStorageInBytes":0,"usedStorageInBytes":0},"clusterType":"ESX_CLUSTER","createdAt":"2024-07-17T15:57:09Z","customerId":"bb20052ac81011ed895f7a6e2fba2c57","displayName":"mclaren01","drsConfigInfo":{"defaultVmBehavior":"fullyAutomated","enableVmBehaviorOverrides":true,"enabled":true,"vmotionRate":3},"generation":1,"hciClusterUuid":"126fd201-9e6e-5e31-9ffb-a766265b1fd3","hypervisorHosts":null,"hypervisorManagerInfo":{"displayName":"16.182.107.157","id":"c47b89e9-3a66-4fb9-9a22-cdec3c51604d","name":"16.182.107.157","resourceUri":"/virtualization/v1beta1/hypervisor-managers/c47b89e9-3a66-4fb9-9a22-cdec3c51604d","type":"virtualization/hypervisor-manager"},"id":"298a299e-78f5-5acb-86ce-4e9fdc290ab7","name":"mclaren01","networksInfo":null,"resourceUri":"/virtualization/v1beta1/hypervisor-clusters/298a299e-78f5-5acb-86ce-4e9fdc290ab7","services":["hci-manager"],"state":"OK","stateReason":"OK","status":"OK","type":"virtualization/hypervisor-cluster","updatedAt":"2024-07-17T15:57:09Z"} ], "count": 1, "offset": 0, "total": 1} | ||
|