[openstack-dev] [Quantum] API (action=clear): reset to default value vs set empty value

gong yong sheng gongysh at linux.vnet.ibm.com
Fri Dec 28 13:54:47 UTC 2012


On 12/28/2012 03:14 PM, Akihiro MOTOKI wrote:
> Hi Quantum folks,
>
> During the review https://review.openstack.org/#/c/18018/,
> A question on the API layer has been raised: What is the meaning of 'None'?
>
> In the review a problem that a meaning of passing 'None' in Quantum API
> (action=clear) for an attribute is ambiguous has been raised.
> A word "clear" is used in two meanings: (a) to set an empty value,
> and (b) to reset to default.
>
> These are similar in many cases, but they have different meanings.
> For example, let's assume attribute X is a list and its default value is [1,2].
> "Setting an empty value" means that [] is set to X, and "reseting to default"
> means that [1,2] is set to X.
>
>
> I believe these two should be distinguished on the API layer.
> The API layer shoule provide:
> - a way to set an empty value (e.g., "", [], {}), and
> - a way to reset to its default value
>
>
> IMO, the former is innevitable since the API should not limit a value which
> is valid for a specific attribute, and the latter is very useful if supported.
>
> My proposal is
> - The API layer provides a way to specify an emtpy value (e.g., "", [], {})
> - Make 'None (null in json)' an reserved value and if None is passed a
>   corresponding attribute is reset to its default value.
>
>
> My only concern is gateway_ip attribute of subnet resource.
> gateway_ip = None means the subnet has no gateway.
> It is different from my proposal above and
> we need to keep backward compatibility of the API.
> (Of cource I know there were many discussion about gateway_ip = None)
>
> What dou you think?
>
>
> [Background]
>
> Recently quantumclient introduced "action=clear" which passes 'None'
> (null in JSON) to the Quantum server for a specified attribute.
> It is originally intended to set an empty value explicitly,
> e.g. reset dns_nameservers of subnet to [].
action=clear is to allow cli command to pass an 'unified' value, for
example json None to API.  How to deal with it is left to
API server side.
> Thanks,
> Akihiro
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>




More information about the OpenStack-dev mailing list