[openstack-dev] [api][ironic] some questions about tags

Ryan Brown rybrown at redhat.com
Thu Oct 22 16:41:38 UTC 2015


On 10/21/2015 11:14 PM, Tan, Lin wrote:
> Hi guys,
>
> Ironic is implementing the tags stuff:
> https://review.openstack.org/#/q/status:open+project:openstack/ironic+branch:master+topic:bp/nodes-tagging,n,z
>
> And this work is follow the guidelines of API Workgroup:
> http://specs.openstack.org/openstack/api-wg/guidelines/tags.html
>
> But I have two doubts about the guideline:
> 1. Can we support partial update the Tag List using PATCH. I see there is an option to add/delete individual tag, but it is still using PUT. What's the disadvantage here for PATCH?

The major disadvantage of PATCH is that there isn't an official standard 
for partial representation of things like lists. There are things like 
JSONPatch[1] that provide guidance, but since OpenStack hasn't really 
made a choice, we haven't put up a guideline.

For information on what we *have* done regarding PATCH, see the HTTP 
Methods guide[2].

> 2. Can we update the tag as well? For example, in Gmail we can rename the label if necessary, which is much more friendly to me. But currently, this is not support from the guide. The only way to support this is cached the tags's entities and retag them in python client, I don't think it's a good way.

The idea behind our guideline is to specify the way the API should allow 
users to access the tags on their resources. You can (of course!) extend 
functionality and add the ability to rename tags if you'd like.

If you were to use PATCH, then renaming a tag could look like:

step 1: get servers with tag X
step 2: PATCH
   [
     {"op": "replace", "path": "/tags/1", "value": "Y"}
   ]

That would replace the existing tag with the new one, if you were using 
JSONPatch.

> Best Regards,
>
> Tan

1: http://jsonpatch.com/
2: 
http://specs.openstack.org/openstack/api-wg/guidelines/http.html#http-methods
-- 
Ryan Brown / Senior Software Engineer, Openstack / Red Hat, Inc.



More information about the OpenStack-dev mailing list