[openstack-dev] [Fuel] Pecan migration status

Przemyslaw Kaminski pkaminski at mirantis.com
Tue Mar 24 08:09:17 UTC 2015

BTW, old urls do not match as yet exactly the new ones. There is a need
to write a test that will check all urls.py list and compare with new
handlers' urls to make sure nothing was missed.


On 03/24/2015 08:46 AM, Przemyslaw Kaminski wrote:
> Hello,
> I want to summarize work I've done in spare time on migrating our API to
> Pecan [1]. This is partially based on previous Nicolay's work [2]. One
> test is still failing there but it's some DB lock and I'm not 100% sure
> that this is caused because something is yet not done on Pecan side or
> just some bug popped out (I was getting a different DB lock before but
> it disappeared after rebasing a fix for [5]).
> My main commitment here is the 'reverse' method [3] which is not
> provided by default in Pecan. I have kept compatibility with original
> reverse method in our code. I have additionally added a 'qs' keyword
> argument that is used for adding a query string to the URL (see
> test_node_nic_handler.py::test_change_mac_of_assigned_nics::get_nodes,
> test_node_nic_handler.py::test_remove_assigned_interfaces::get_nodes)
> I decided to keep original Nicolay's idea of copying all handlers to v2
> directory and not just modify original v1 handlers and concentrated
> instead of removing hacks around Pecan as in [6] (with post_all,
> post_one, put_all, put_one, etc). Merging current v2 into v1 should
> drastically decrease the number of changed lines in this patchset.
> I have so far found one fault in the URLs in our API that isn't easily
> handled by Pecan (some custom _route function would help) and IMHO
> should be fixed by rearranging URLs instead of adding _route hacks:
> /nodes/interfaces and /nodes/1/interfaces require the same get_all
> method in the interfaces controller. And /nodes/interfaces only usage is
> for doing a batch node interface update via PUT. The current v2 can be
> merged into v1 with some effort.
> We sometimes use a PUT request without specifying an object's ID -- this
> is unsupported in Pecan but can be easily hacked by giving a dummy
> keyword argument to function's definition:
> def put(self, dummy=None)
> Some bugs in tests were found and fixed (for example, wrong content-type
> in headers in [4]).
> I haven't put enough thought into error handling there yet, some stuff
> is implemented in hooks/error.py but I'm not fully satisfied with it.
> Most unfinished stuff I was marking with a TODO(pkaminski).
> P.
> [1] https://review.openstack.org/158661
> [2] https://review.openstack.org/#/c/99069/6
> [3]
> https://review.openstack.org/#/c/158661/35/nailgun/nailgun/api/__init__.py
> [4]
> https://review.openstack.org/#/c/158661/35/nailgun/nailgun/test/unit/test_handlers.py
> [5] https://bugs.launchpad.net/fuel/+bug/1433528
> [6]
> https://review.openstack.org/#/c/99069/6/nailgun/nailgun/api/v2/controllers/base.py

More information about the OpenStack-dev mailing list