<div dir="ltr"><div><div>Basically #2 makes sense to me.</div></div><div><br></div><div><div>> 2) Enrich/enhance the NeutronServer exceptions with a type and detail properties.</div><div>> This way, when a NeutronServer exception is serialized and sent to python-neutronclient,</div>
<div>> the specific NeutronClient exception can be raised (and then sent to nova-api).</div></div><div style><br></div><div style>What granularity are you thinking? I am not sure what information is passed as "type" and "detail".</div>
<div style>Could you give an example you think?</div><div style><br></div><div style>Exceptions in neutron-server side are classified into categories and a status code of response</div><div style>is determined based on these categories. There is a case where multiple categories are mapped</div>
<div style>into a single status code. If the granularity of the client exceptions is same as these categories,</div><div style>it seems easy to map categories into client-side exceptions (by using "type").</div>
<div style><br></div><div style>If more detail granularity is needed, the situation becomes more complicated.</div><div style>If we map server-side exception into client-side exception one to one, </div><div style>whenever server-side exceptions changes/increases neutron client needs to catch up with it<br>
</div><div style>In addition some exceptions are sometimes defined in extensions. This makes more difficult</div><div style>to one-to-one mapping.</div><div style><br></div><div style>Any thought?</div><div style><br></div>
<div style>Thanks,</div><div style>Akihiro</div><div><div><br></div></div><div class="gmail_extra"><div class="gmail_quote">2013/7/5 Jordan Pittier <span dir="ltr"><<a href="mailto:jpittier@octo.com" target="_blank">jpittier@octo.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi guys,<div><br></div><div>Nova-api makes extensive use of python-neutronclient. But the only exception from neutronclient that nova-api catches is the generic QuantumClientException (defined in quantumclient/common/exceptions.py).</div>


<div><br></div><div>neutronclient has some more specific exceptions like PortInUseClient, NetworkNotFoundClient. But they are never raised because I believe there is a bug either in neutron server or in neutronclient, related to exceptions.</div>


<div><br></div><div>In neutronclient, all exceptions are handled in neutronclient/v2_0/client.py::exception_handler_v20(). The code is supposed to catch a Neutron(Server)Exception and raise the corresponding specific NeutronClientException. In order to do that, NeutronClient expects the deserialized Neutron(Server)Exception to be a dictionnary which has the keys "type","message" and "detail". But, these keys are never found in any Neutron(Server)Exceptions so, instead the generic NeutronClientException is raised.</div>


<div><br></div><div>If you look at how Neutron(Server) exceptions are defined (quantum/quantum/common/exceptions.py), indeed there's no mention of 'type' or 'detail' (though 'message' is defined). So its "logic" that neutronclient always raises the generic NeutronClientException.</div>


<div><br></div><div>Also see this bug reports : </div><div><a href="https://bugs.launchpad.net/python-neutronclient/+bug/1178734" target="_blank">https://bugs.launchpad.net/python-neutronclient/+bug/1178734</a><br></div>
<div><a href="https://bugs.launchpad.net/python-neutronclient/+bug/1187698" target="_blank">https://bugs.launchpad.net/python-neutronclient/+bug/1187698</a><br>

</div><div><br></div><div><br></div><div>What should we do about this ? :</div><div>1) Pretty much nothing. Nova-api still catches only the generic NeutronClientException, and based the further processing of the exception on the correct status_code reported by neutronclient. In that case, we should clean the code of neutronclient::exception_handler_v20() because it has a lot of dead code. </div>


<div>2) Enrich/enhance the NeutronServer exceptions with a type and detail properties. This way, when a NeutronServer exception is serialized and sent to python-neutronclient, the specific NeutronClient exception can be raised (and then sent to nova-api).</div>


<div>3) You tell me :) !</div><div><br></div><div>Thanks a lot</div><span class=""><font color="#888888"><div>Jordan</div><div><br></div><div><br></div><div><br></div></font></span></div>
<br>_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Akihiro MOTOKI <<a href="mailto:amotoki@gmail.com" target="_blank">amotoki@gmail.com</a>>
</div></div>