<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
tt
{mso-style-priority:99;
font-family:"Courier New";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">You are right. The API should return 404, and the CLI should issue the nice error message.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Best Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Ifat.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Zhang Yujun [mailto:zhangyujun+zte@gmail.com]
<br>
<b>Sent:</b> Wednesday, May 25, 2016 10:10 AM<br>
<b>To:</b> OpenStack Development Mailing List (not for usage questions); dong.wenjuan@zte.com.cn<br>
<b>Cc:</b> Shamir, Ohad (Nokia - IL)<br>
<b>Subject:</b> Re: [openstack-dev] [vitrage] input erroneous `vitrage_id` in `vitrage rca show`API or `vitrage topology show` API<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi, all<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I'm not sure if vitrage follows the RESTful API.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">In RESTful API, it is reasonable to return 404 error when the requested resource does not exist. If we want to display a friendly message, it could be implemented in front end.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">The backend API should remain simple and consistent since we may have different consumers, e.g. a CLI who does not understand error message at all.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">--<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Yujun ZHANG<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Wed, May 25, 2016 at 2:57 PM Afek, Ifat (Nokia - IL) <<a href="mailto:ifat.afek@nokia.com">ifat.afek@nokia.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi dwj,</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I’m passing the question (and answer) to openstack mailing list.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">You are right. In case of an invalid vitrage id, we should not return HTTP 404 error. I think the
correct behavior would be to return a nice error message like “Alarm XYZ does not exist”.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">You can open a bug about it.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks,</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Ifat.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">
<a href="mailto:dong.wenjuan@zte.com.cn" target="_blank">dong.wenjuan@zte.com.cn</a> [mailto:<a href="mailto:dong.wenjuan@zte.com.cn" target="_blank">dong.wenjuan@zte.com.cn</a>]
<br>
<b>Sent:</b> Wednesday, May 25, 2016 9:24 AM<br>
<b>To:</b> Weyl, Alexey (Nokia - IL); Afek, Ifat (Nokia - IL); Rosensweig, Elisha (Nokia - IL); Shamir, Ohad (Nokia - IL)<br>
<b>Subject:</b> input erroneous `vitrage_id` in `vitrage rca show`API or `vitrage topology show` API</span><o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"">Hi folks,</span> <br>
<br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"">`vitrage rca show` has the positional arguments: alarm_id
</span><br>
<br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"">`vitrage topology show` API has the optional arguments: --root</span>
<br>
<br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"">They all means the `vitrage_id` in vertex, and those APIs also call the</span>
<br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"">function of `</span><b><span style="font-size:10.0pt;font-family:"Courier New"">graph_query_vertices</span></b><span style="font-size:10.0pt;font-family:"Courier New"">(<i>self</i>, query_dict=<span style="color:blue">None</span>,
root_id=<span style="color:blue">None</span>, depth=<span style="color:blue">None</span>,</span>
<br>
<span style="font-size:10.0pt;font-family:"Courier New""> direction=Direction.BOTH)</span><span style="font-size:10.0pt;font-family:"Arial","sans-serif"">`</span>
<br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif""><br>
</span><span style="font-size:10.0pt">But if the user input the erroneous</span><tt><span style="font-size:10.0pt;color:#333333">
</span></tt><span style="font-size:10.0pt;font-family:"Arial","sans-serif"">`vitrage_id`</span><span style="font-size:10.0pt"> which was not exist in the nodes,</span>
<br>
<span style="font-size:10.0pt">Do the APIs all need to return the HTTP 404 error?</span>
<br>
<br>
<span style="font-size:10.0pt">See the code: </span><br>
<span style="font-size:10.0pt"><a href="https://github.com/openstack/vitrage/blob/master/vitrage/graph/algo_driver/networkx_algorithm.py#L43" target="_blank">https://github.com/openstack/vitrage/blob/master/vitrage/graph/algo_driver/networkx_algorithm.py#L43</a></span>
<br>
<br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"">Do we need to unify the return value as a empty graph in function `</span><b><span style="font-size:10.0pt;font-family:"Courier New"">graph_query_vertices</span></b><span style="font-size:10.0pt;font-family:"Arial","sans-serif"">`
</span><br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"">if the root is not be found or the root_data don't match the query?</span>
<br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"">Or leave it, don't modify, return the HTTP 404?</span>
<br>
<br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"">Thanks.</span> <br>
<br>
<span style="font-size:10.0pt">The error log:</span> <br>
<span style="font-size:10.0pt">stack@cloud:~$ vitrage rca show 'ALARM:nagios:cloud:test'</span>
<br>
<span style="font-size:10.0pt">Unknown Error (HTTP 404)</span> <br>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.734 10742 DEBUG vitrage.entity_graph.api_handler.entity_graph_api [-] EntityGraphApis get_rca root:ALARM:nagios:cloud:test get_rca /opt/stack/vitrage/vitrage/entity_graph/api_handler/entity_graph_api.py:114</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher [-] Exception during message handling: u'ALARM:nagios:cloud:test'</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher Traceback (most recent call last):</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 138, in _dispatch_and_reply</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher incoming.message))</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 185, in _dispatch</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher return self._do_dispatch(endpoint, method, ctxt, args)</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 127, in _do_dispatch</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher result = func(ctxt, **new_args)</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher File "/opt/stack/vitrage/vitrage/entity_graph/api_handler/entity_graph_api.py", line 120, in get_rca</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher direction=Direction.IN)</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher File "/opt/stack/vitrage/vitrage/graph/algo_driver/networkx_algorithm.py", line 43, in graph_query_vertices</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher root_data = self.graph._g.node[root_id]</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher KeyError: u'ALARM:nagios:cloud:test'</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher
</span><br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.759 10742 ERROR oslo_messaging._drivers.common [-] Returning exception u'ALARM:nagios:cloud:test' to caller</span>
<br>
<br>
BR, <br>
dwj <o:p></o:p></p>
<pre><span style="color:blue"> </span><o:p></o:p></pre>
<pre><span style="color:blue">--------------------------------------------------------</span><o:p></o:p></pre>
<pre><span style="color:blue">ZTE Information Security Notice: The information contained in this mail (and any attachment transmitted herewith) is privileged and confidential and is intended for the exclusive use of the addressee(s). If you are not an intended recipient, any disclosure, reproduction, distribution or other dissemination or use of the information contained is strictly prohibited. If you have received this mail in error, please delete it and notify us immediately.</span><o:p></o:p></pre>
<pre><span style="color:blue"> </span><o:p></o:p></pre>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
</div>
<p class="MsoNormal">__________________________________________________________________________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" target="_blank">
OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</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><o:p></o:p></p>
</blockquote>
</div>
</div>
</body>
</html>