4.1. Creating traits¶
PUT /traits/{name}
Insert a new custom trait. If the trait already exists, 204 is returned. This API call requires custom parameters that are only supported in Virtuozzo Hybrid Infrastructure.
There are two kinds of traits: the standard traits and the custom traits. The standard traits are interoperable across different OpenStack cloud deployments. The definition of standard traits comes from the os-traits library. The standard traits are read-only in the placement API which means that the user cannot modify any standard traits through API. The custom traits are used by admin users to manage the non-standard qualitative information of resource providers.
A custom trait name for Virtuozzo Hybrid Infrastructure looks like CUSTOM_HCI_<UUID>
, where the <UUID> must be generated using Python’s uuid4() function as follows:
>>> str(uuid.uuid4()).upper().replace('-', '')
'E4A64BAA4BE84887ADE712ABB9B5882A'
So a complete name would be
CUSTOM_HCI_E4A64BAA4BE84887ADE712ABB9B5882A
4.1.1. Request¶
Name | In | Type | Description |
---|---|---|---|
name |
path | string | The name of a trait. |
display_name |
body | string | A human-readable trait name to be displayed in the admin panel. |
description |
body | string | A human-readable trait description to be displayed in the admin panel. |
4.1.1.1. Example¶
curl -ks -X PUT -H 'Content-Type: application/json' -H 'OpenStack-API-Version: placement 1.32' -H 'X-Auth-Token: gAAAAA<...>' -d '
{
"display_name": "placement2",
"description": "Sample placement #2"
}' https://<node_IP_addr>:8780/traits/CUSTOM_HCI_0A7F6A35E650420CB30200A8359861D9