[openstack-dev] [Nova] v2 or v3 for new api

Christopher Yeoh cbkyeoh at gmail.com
Mon Nov 17 11:15:16 UTC 2014


On Mon, Nov 17, 2014 at 7:30 PM, Pasquale Porreca <
pasquale.porreca at dektech.com.au> wrote:

>  Thank you for the clarification, yes I know about the
> blueprint/specification, I submitted yet them and the spec is currently
> under review :)
>
> I noticed there are several steps one has always to do to enable and make
> a v3 api to work and pass the tests. It would be awesome to have a
> guideline or something similar that explain these steps, but I didn't find
> anything in wiki or documentation.
>
>
Yes, sorry documentation has been on our todo list for too long. Could I
get you to submit a bug report about the lack of developer documentation
for api plugins? It might hurry us up :-)

In the meantime, off the top of my head..... you'll need to create or
modify the following files in a typical plugin:

setup.cfg - add an entry in at least the nova.api.v3.extensions section

etc/nova/policy.json - an entry for the permissions for you plugin, perhaps
one per api method for maximum flexibility. Also will need a discoverable
entry (lots of examples in this file)

nova/tests/unit/fake_policy.json (similar to policy.json)

nova/api/openstack/compute/plugins/v3/<your_plugin.py> - please make the
alias name something os-scheduler-hints rather than OS-SCH-HNTS. No
skimping on vowels. Probably the easiest way at this stage without more
doco is look for for a plugin in that directory that does the sort of the
thing you want to do.

nova/tests/unit/nova/api/openstack/compute/contrib/test_your_plugin.py - we
have been combining the v2 and v2.1(v3) unittests to share as much as
possible, so please do the same here for new tests as the v3 directory will
be eventually removed. There's quite a few examples now in that directory
of sharing unittests between v2.1 and v2 but with a new extension the
customisation between the two should be pretty minimal (just a bit of
inheritance to call the right controller)

nova/tests/unit/integrated/v3/test_your_plugin.py
nova/tests/unit/integrated/test_api_samples.py

Sorry the api samples tests are not unified yet. So you'll need to create
two. All of the v2 api sample tests are in one directory, whilst the the
v2.1 are separated into different files by plugin.

There's some rather old documentation on how to generate the api samples
themselves (hint: directories aren't made automatically) here:

https://blueprints.launchpad.net/nova/+spec/nova-api-samples

Personally I wouldn't bother with any xml support if you do decide to
support v2 as its deprecated anyway.

Hope this helps. Feel free to add me as a reviewer for the api parts of
your changesets.

Regards,

Chris



> In particular I noticed I had to modify the file
> nova/nova.egg-info/entry_points.txt to make my v3 api to load, but this
> file seems not to be under versioning, is this file modified only after the
> changes are merged?
>
>
> On 11/16/14 23:55, Christopher Yeoh wrote:
>
>  On Thu, Nov 13, 2014 at 12:14 AM, Pasquale Porreca <
> pasquale.porreca at dektech.com.au> wrote:
>
>> Hello
>>
>> I am working on an api for a new feature in nova, but I am wondering what
>> is the correct way to add a new extension: should it be supported by v2, v3
>> or both?
>>
>>
>  You need now to have at least a v2.1 (formerly known as v3) extension.
> V2 support if you want but I think once v2.1 is fully merged and tested
> (which may not be that far away at all) we should freeze v2 and rely just
> on v2.1 for new features. Otherwise the interaction between v2.1 being
> exactly equivalent to v2 plus having microversion support for v2.1 will get
> a bit confusing.
>
> As the other Chris mentioned, the first step however is to get a nova-spec
> submitted which needs to fully describe the API additions that you want to
> make.
>
>  Regards,
>
>  Chris
>
>  BR
>>
>> --
>> Pasquale Porreca
>>
>> DEK Technologies
>> Via dei Castelli Romani, 22
>> 00040 Pomezia (Roma)
>>
>> Mobile +39 3394823805
>> Skype paskporr
>>
>>
>> _______________________________________________
>> OpenStack-dev mailing list
>> OpenStack-dev at lists.openstack.org
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>
>
>
>
> _______________________________________________
> OpenStack-dev mailing listOpenStack-dev at lists.openstack.orghttp://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
> --
> Pasquale Porreca
>
> DEK Technologies
> Via dei Castelli Romani, 22
> 00040 Pomezia (Roma)
>
> Mobile +39 3394823805
> Skype paskporr
>
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20141117/00532b0c/attachment.html>


More information about the OpenStack-dev mailing list