[openstack-dev] [all][api][tc][perfromance] API for getting only status of resources

John Garbutt john at johngarbutt.com
Wed Nov 4 15:13:54 UTC 2015


On 4 November 2015 at 14:49, Jay Pipes <jaypipes at gmail.com> wrote:
> On 11/04/2015 09:32 AM, Sean Dague wrote:
>>
>> On 11/04/2015 09:00 AM, Jay Pipes wrote:
>>>
>>> On 11/03/2015 05:20 PM, Boris Pavlovic wrote:
>>>>
>>>> Hi stackers,
>>>>
>>>> Usually such projects like Heat, Tempest, Rally, Scalar, and other tool
>>>> that works with OpenStack are working with resources (e.g. VM, Volumes,
>>>> Images, ..) in the next way:
>>>>
>>>>   >>> resource = api.resouce_do_some_stuff()
>>>>   >>> while api.resource_get(resource["uuid"]) != expected_status
>>>>   >>>    sleep(a_bit)
>>>>
>>>> For each async operation they are polling and call many times
>>>> resource_get() which creates significant load on API and DB layers due
>>>> the nature of this request. (Usually getting full information about
>>>> resources produces SQL requests that contains multiple JOINs, e,g for
>>>> nova vm it's 6 joins).
>>>>
>>>> What if we add new API method that will just resturn resource status by
>>>> UUID? Or even just extend get request with the new argument that returns
>>>> only status?
>>>
>>>
>>> +1
>>>
>>> All APIs should have an HTTP HEAD call on important resources for
>>> retrieving quick status information for the resource.
>>>
>>> In fact, I proposed exactly this in my Compute "vNext" API proposal:
>>>
>>> http://docs.oscomputevnext.apiary.io/#reference/server/serversid/head
>>>
>>> Swift's API supports HEAD for accounts:
>>>
>>>
>>> http://developer.openstack.org/api-ref-objectstorage-v1.html#showAccountMeta
>>>
>>>
>>> containers:
>>>
>>>
>>> http://developer.openstack.org/api-ref-objectstorage-v1.html#showContainerMeta
>>>
>>>
>>> and objects:
>>>
>>>
>>> http://developer.openstack.org/api-ref-objectstorage-v1.html#showObjectMeta
>>>
>>> So, yeah, I agree.
>>> -jay
>>
>>
>> How would you expect this to work on "servers"? HEAD specifically
>> forbids returning a body, and, unlike swift, we don't return very much
>> information in our headers.
>
>
> I didn't propose doing it on a collection resource like "servers". Only on
> an entity resource like a single "server".
>
> HEAD /v2/{tenant}/servers/{uuid}
> HTTP/1.1 200 OK
> Content-Length: 1022
> Last-Modified: Thu, 16 Jan 2014 21:12:31 GMT
> Content-Type: application/json
> Date: Thu, 16 Jan 2014 21:13:19 GMT
> OpenStack-Compute-API-Server-VM-State: ACTIVE
> OpenStack-Compute-API-Server-Power-State: RUNNING
> OpenStack-Compute-API-Server-Task-State: NONE

For polling, that sounds quite efficient and handy.

For "servers" we could do this (I think there was a spec up that wanted this):

HEAD /v2/{tenant}/servers
HTTP/1.1 200 OK
Content-Length: 1022
Last-Modified: Thu, 16 Jan 2014 21:12:31 GMT
Content-Type: application/json
Date: Thu, 16 Jan 2014 21:13:19 GMT
OpenStack-Compute-API-Server-Count: 13

Thanks,
johnthetubaguy



More information about the OpenStack-dev mailing list