[openstack-dev] [nova] Future of the Nova API

Chris Friesen chris.friesen at windriver.com
Fri Feb 28 05:40:46 UTC 2014


On 02/27/2014 06:00 PM, Alex Xu wrote:

> Does mean our code looks like as below?
> if client_version > 2:
>     ....
> elif client_version > 3
>     ...
> elif client_version > 4:
>    ...
> elif client_version > 5:
>    ...
> elif client_version > 6:
>    ..
>
> And we need test each version...  That looks bad...

I don't think the code would look like that

Each part of the API could look at the version separately.  And each 
part of the API only needs to check the client version if it has made a 
backwards-incompatible change.

So a part of the API that only made one backwards-incompatible change at 
version 3 would only need one check.

if client_version >= 3
	do_newer_something()
else
	do_something()



Maybe some other part of the API made a change at v6 (assuming global 
versioning).  That part of the API would also only need one check.


if client version >= 6
	do_newer_something()
else
	do_something()


Chris




More information about the OpenStack-dev mailing list