4.11. Updating aggregate metadata¶
POST /os-aggregates/{aggregate_id}/action
Creates or replaces metadata for an aggregate.
Specify the set_metadata
action and metadata info in the request body.
4.11.1. Request¶
Name | In | Type | Description |
---|---|---|---|
aggregate_id |
path | integer | The aggregate ID. |
set_metadata |
body | object | The set_metadata object used to set metadata for host aggregate. |
metadata |
body | object | Metadata key and value pairs associated with the aggregate. The maximum size for each metadata key and value pair is 255 bytes. New keys will be added to existing aggregate metadata. For existing
keys, if the value is Warning You should not change the availability zone of an aggregate when that aggregate has hosts which contain servers in it since that may impact the ability for those servers to move to another host. |
4.11.1.1. Example¶
Associate a trait with a host aggregate:
curl -ks -X POST -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' -d '
{
"set_metadata": {
"metadata": {
"trait:CUSTOM_HCI_0A7F6A35E650420CB30200A8359861D9": "required"
}
}
}' https://<node_IP_addr>:8774/v2.1/6ef5371261ea42008e3d1d41ba051977/os-aggregates/4/action
4.11.2. Response¶
Name | In | Type | Description |
---|---|---|---|
aggregate |
body | object | The host aggregate object. |
availability_zone |
body | string | The availability zone of the host aggregate. |
created_at |
body | string | The date and time when the resource was created. The date and time stamp format is ISO 8601 CCYY-MM-DDThh:mm:ss±hh:mm
For example, |
deleted_at |
body | string | The date and time when the resource was deleted. If the resource has
not been deleted yet, this field will be CCYY-MM-DDThh:mm:ss±hh:mm
For example, |
deleted |
body | boolean | A boolean indicates whether this aggregate is deleted or not, if it has
not been deleted, false will appear. |
hosts |
body | array | An array of host information. |
id |
body | integer | The ID of the host aggregate. |
metadata |
body | object | Metadata key and value pairs associated with the aggregate. |
name |
body | string | The name of the host aggregate. |
updated_at |
body | string | The date and time when the resource was updated, if the resource has
not been updated, this field will show as CCYY-MM-DDThh:mm:ss±hh:mm
For example, |
uuid |
body | string | The UUID of the host aggregate. New in version 2.41 |
4.11.2.1. Status codes¶
4.11.2.1.1. Success¶
Code | Reason |
---|---|
200 - OK |
Request was successful. |
4.11.2.1.2. Error¶
Code | Reason |
---|---|
400 - Bad Request |
Some content in the request was invalid. |
401 - Unauthorized |
User must authenticate before making a request. |
403 - Forbidden |
Policy does not allow current user to do this operation. |
404 - Not Found |
The requested resource could not be found. |
4.11.2.2. Example¶
{
"aggregate": {
"name": "CUSTOM_HCI_0A7F6A35E650420CB30200A8359861D9",
"availability_zone": null,
"deleted": false,
"created_at": "2020-04-19T12:56:10.191466",
"updated_at": null,
"deleted_at": null,
"id": 4,
"metadata": {
"trait:CUSTOM_HCI_0A7F6A35E650420CB30200A8359861D9": "required"
}
}
}