<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le ven. 29 sept. 2023, 12:41, Gk Gk <<a href="mailto:ygk.kmr@gmail.com">ygk.kmr@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Thanks for the response. But this is not the answer I was looking for. I am asking how wsgi is implemented in the nova-api server. How to understand these python classes ?</div><div><br></div><div>How does the flow of control go from one module to another ? Specifically wsgi related. Is there any design doc which talks about this ? Are there any resources on the internet along these lines? <br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote></blockquote></div></div><div dir="auto"><br></div><div dir="auto"><div style="font-size:12.8px" dir="auto">Short answer : nova-api is a WSGI app. We use pastedeploy [1] for providing WSGI pipelines [2]. Each of the pipelines verify WSGI middlewares one after the other, and eventually it goes to the Nova APIRouterV21 WSGI middleware [3]</div><div style="font-size:12.8px" dir="auto">The APIRouterV21 then calls the right HTTP controller related to the link, as you can see in [4].<br></div><div style="font-size:12.8px" dir="auto"><br></div><div style="font-size:12.8px" dir="auto">For example, the call of POST /servers in <a href="https://docs.openstack.org/api-ref/compute/#create-server" style="text-decoration-line:none;color:rgb(66,133,244)">https://docs.openstack.org/api-ref/compute/#create-server</a> is then eventually calling [5], depending on the microversion of course.</div><div style="font-size:12.8px" dir="auto"><br></div><div style="font-size:12.8px" dir="auto">HTH,</div><div style="font-size:12.8px" dir="auto">-Sylvain</div><div style="font-size:12.8px" dir="auto"><br></div><div style="font-size:12.8px" dir="auto">[1] <a href="https://pastedeploy.readthedocs.io/" style="text-decoration-line:none;color:rgb(66,133,244)">https://pastedeploy.readthedocs.io</a></div><div style="font-size:12.8px" dir="auto">[2] <a href="https://github.com/openstack/nova/blob/87d4807848bb9546c1fca972da2eb2eda13eb08d/etc/nova/api-paste.ini#L18-L43" style="text-decoration-line:none;color:rgb(66,133,244)">https://github.com/openstack/nova/blob/87d4807848bb9546c1fca972da2eb2eda13eb08d/etc/nova/api-paste.ini#L18-L43</a></div><div style="font-size:12.8px" dir="auto">[3] <a href="https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/routes.py" style="text-decoration-line:none;color:rgb(66,133,244)">https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/routes.py</a></div><div style="font-size:12.8px" dir="auto">[4] <a href="https://github.com/openstack/nova/blob/87d4807848bb9546c1fca972da2eb2eda13eb08d/nova/api/openstack/compute/routes.py#L369C4-L842" style="text-decoration-line:none;color:rgb(66,133,244)">https://github.com/openstack/nova/blob/87d4807848bb9546c1fca972da2eb2eda13eb08d/nova/api/openstack/compute/routes.py#L369C4-L842</a></div><div style="font-size:12.8px" dir="auto">[5] <a href="https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/servers.py#L683" style="text-decoration-line:none;color:rgb(66,133,244)">https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/servers.py#L683</a></div></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br></blockquote><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 27, 2023 at 8:59 PM Stephen Finucane <<a href="mailto:stephenfin@redhat.com" target="_blank" rel="noreferrer">stephenfin@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div>On Wed, 2023-09-27 at 19:41 +0530, Gk Gk wrote:</div><blockquote type="cite" style="margin:0px 0px 0px 0.8ex;border-left:2px solid rgb(114,159,207);padding-left:1ex"><div dir="ltr"><div>Hi All,</div><div><br></div><div>I am new to python coding and trying to understand how wsgi is implemented in nova or glance api servers. What would be the best way to understand the design here ? Are there any useful documents available over the internet to understand these ? I understand the WSGI standard. I can't figure out where the start_response functions are coded in nova-api wsgi implementation. Any useful tips are highly appreciated. Thanks so much for your time.</div><div><br></div><div>Thanks</div><div>Y.G<br></div></div></blockquote><div><br></div><div>Script for WSGI "entry points" are automatically generated by pbr, similar to how standard setuptools builds scripts for console scripts:</div><div><br></div><div><a href="https://github.com/openstack/pbr/blob/d03d617c09e7ba8ddf62d1e53d71685cd708e2da/pbr/packaging.py#L332-L384" target="_blank" rel="noreferrer">https://github.com/openstack/pbr/blob/d03d617c09e7ba8ddf62d1e53d71685cd708e2da/pbr/packaging.py#L332-L384</a></div><div><br></div><div>If you build an sdist or wheel and extract it, you'll see the generated scripts in there. You'll also see then in `bin` if you install e.g. nova and look at the `nova-api` script.</div><div><br></div><div>Stephen</div><div><span></span></div></div>
</div></blockquote></div>
</blockquote></div></div></div>