[Openstack] Traits is not working
Jay Pipes
jaypipes at gmail.com
Thu Oct 5 14:07:33 UTC 2017
On 10/05/2017 05:26 AM, Ramu, MohanX wrote:
> Hi Jay,
>
> I want to create the Custom traits with the property value attached to it.
>
> FOR Ex:
>
> I want to have CUSTOM_xyz traits with "status": "true".
That's not a trait :) That's a status indicator.
Traits are simple string tags that represent a single-valued thing or
capability. A status is a multi-valued field.
> When the CUSTOM_xyz traits is associated to a resource provider I should be able to see the status value is true or not.
A trait is either associated with a resource provider or it isn't. When
you do a call to `GET /resource_providers/{rp_uuid}/traits` what is
returned is a list of the traits the resource provider with UUID
{rp_uuid} has associated with it.
> I referred below link to create custom traits , not able to create.
>
> https://specs.openstack.org/openstack/nova-specs/specs/pike/implemented/resource-provider-traits.html
>
> PUT /resource_providers/{uuid}/traits
>
> This API is to associate traits with specified resource provider. All the associated traits will be replaced by the traits specified in the request body. Nova-compute will report the compute node traits through this API.
>
> The body of the request must match the following JSONSchema document:
>
> {
> "type": "object",
> "properties": {
> "traits": {
> "type": "array",
> "items": CUSTOM_TRAIT
> },
> "resource_provider_generation": {
> "type": "integer"
> }
> },
> 'required': ['traits', 'resource_provider_generation'],
> 'additionalProperties': False
> }
I suspect the issue you're having is that you need to create the custom
trait first and *then* associate that trait with one or more resource
providers.
To create the trait, do:
PUT /traits/CUSTOM_XYZ
and then associate it to a resource provider by doing:
PUT /resource_provider/{rp_uuid}/traits
{
"resource_provider_generation": 1,
"traits": [
"CUSTOM_XYZ"
]
}
BTW, a great place to see examples of both good and bad API usage is to
check out the Gabbit functional API tests for the placement API. Here is
the set of tests for the traits functionality:
https://github.com/openstack/nova/blob/master/nova/tests/functional/api/openstack/placement/gabbits/traits.yaml
Best,
-jay
> Thanks & Regards,
>
> Mohan Ramu
> -----Original Message-----
> From: Jay Pipes [mailto:jaypipes at gmail.com]
> Sent: Wednesday, October 4, 2017 7:06 PM
> To: Ramu, MohanX <mohanx.ramu at intel.com>; openstack at lists.openstack.org
> Subject: Re: [Openstack] Traits is not working
>
> Rock on :)
>
> On 10/04/2017 09:33 AM, Ramu, MohanX wrote:
>> Thank you so much Jay. After adding this header, working fine.
>>
>> -----Original Message-----
>> From: Jay Pipes [mailto:jaypipes at gmail.com]
>> Sent: Tuesday, October 3, 2017 11:36 PM
>> To: openstack at lists.openstack.org
>> Subject: Re: [Openstack] Traits is not working
>>
>> Against the Pike placement API endpoint, make sure you send the following HTTP header:
>>
>> OpenStack-API-Version: placement 1.10
>>
>> Best,
>> -jay
>>
>> On 10/03/2017 02:01 PM, Ramu, MohanX wrote:
>>> Please refer attached original one.
>>>
>>>
>>> -----Original Message-----
>>> From: Jay Pipes [mailto:jaypipes at gmail.com]
>>> Sent: Tuesday, October 3, 2017 10:03 PM
>>> To: Ramu, MohanX <mohanx.ramu at intel.com>;
>>> openstack at lists.openstack.org
>>> Subject: Re: [Openstack] Traits is not working
>>>
>>> On 10/03/2017 12:12 PM, Ramu, MohanX wrote:
>>>> Thanks for reply Jay.
>>>>
>>>> No Jay,
>>>>
>>>> I have installed Pike. There also I face the same problem.
>>>
>>> No, you haven't installed Pike (or at least not properly). Otherwise, the max_version returned from the Pike placement API would be 1.10, not 1.4.
>>>
>>> Best,
>>> -jay
>>>
>>>> Thanks & Regards,
>>>>
>>>> Mohan Ramu
>>>> -----Original Message-----
>>>> From: Jay Pipes [mailto:jaypipes at gmail.com]
>>>> Sent: Tuesday, October 3, 2017 9:26 PM
>>>> To: openstack at lists.openstack.org
>>>> Subject: Re: [Openstack] Traits is not working
>>>>
>>>> On 10/03/2017 11:34 AM, Ramu, MohanX wrote:
>>>>> Hi,
>>>>>
>>>>> We have implemented OpenStack Ocata and Pike releases, able to
>>>>> consume Placement resource providers API, not able to consume resource class APIs’.
>>>>>
>>>>> I tried to run Triats API in Pike set up too. I am not able to run
>>>>> any Traits API.
>>>>>
>>>>> As per the Open Stack doc, the Placement API URL is a base URL for
>>>>> Traits also. I am able to run Placement API as per the given doc,
>>>>> not able to run/access the Traits APIs’ . Getting 404 (Not Found error).
>>>>
>>>> The /traits REST endpoint is part of the Placement API, yes.
>>>>
>>>>> As mentioned in below link, the placement-manage os-traits
>>>>> sync/command is not working, it says that command not found.
>>>>
>>>> This means you have not installed (or updated) packages for Pike.
>>>>
>>>>> https://specs.openstack.org/openstack/nova-specs/specs/pike/approve
>>>>> d
>>>>> /
>>>>> r
>>>>> esource-provider-traits.html
>>>>>
>>>>> Pike – Placement API version is 1.0 to 1.10
>>>>>
>>>>> Ocata – Placement API version is 1.0 to 1.4 which support
>>>>>
>>>>> We got 404 only, It seems there is a disconnect btw Placement and
>>>>> Triats. Need to understand that are we missing any configuration.
>>>>
>>>> You do not have Pike installed. You have Ocata installed. You need to upgrade to Pike.
>>>>
>>>> Best,
>>>> -jay
>>>>
>>>> _______________________________________________
>>>> Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>>>> Post to : openstack at lists.openstack.org
>>>> Unsubscribe :
>>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>>>>
>>
>> _______________________________________________
>> Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>> Post to : openstack at lists.openstack.org
>> Unsubscribe :
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>>
More information about the Openstack
mailing list