<div dir="ltr">Hi, Alexey,<div><br></div><div>Thanks for the detail example. It explains the existing mechanism of vertex creation well.</div><div><br></div><div>So it looks like each resource type will have a primary datasource, e.g. nova.host for nova.host, nova.intance for nova.instance, that holds full details. Is that correct?</div><div><br></div><div>Not sure that you remember the long discussion in static driver review[1] or not. At last, we agreed on a unified entity definition for both `nova.host` and `switch`, no extra key to indicate it is "external" (should create a placeholder).</div><div><br></div><div>If I understand it correctly, no placeholder will be created in this case. Because we can not distinguish them from the static configuration. And the properties of `nova.host` resource shall to be merged from `static` and nova.host` datasources. Is that so?</div><div><br></div><div>[1]: <a href="https://review.openstack.org/#/c/405354/">https://review.openstack.org/#/c/405354/</a>  </div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Dec 14, 2016 at 5:40 PM Weyl, Alexey (Nokia - IL) <<a href="mailto:alexey.weyl@nokia.com">alexey.weyl@nokia.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple" class="gmail_msg">
<div class="m_-452732109767430141WordSection1 gmail_msg">
<p class="MsoNormal gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg">Hi Yujun,<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg">This is a good question, and let me explain for you how it works.<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg">Lets say we are supposed to get 2 entities from nova, nova.host called host1 and nova.instance called vm1 and vm1 is supposed to be connected to host1.<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg">The nova.host driver and nova.instance driver are working simultaneously and thus we don’t know the order in which those events will arrive.<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg">We have 2 use cases:<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="m_-452732109767430141MsoListParagraph gmail_msg"><u class="gmail_msg"></u><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg"><span class="gmail_msg">1.<span style="font:7.0pt "Times New Roman"" class="gmail_msg">      
</span></span></span><u class="gmail_msg"></u><span dir="LTR" class="gmail_msg"></span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg">Host1 event arrives before vm1.<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="m_-452732109767430141MsoListParagraph gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg">In this case the processor will call the transformer of nova.host and will create a vertex for host1 in the graph with the full details of host1.<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="m_-452732109767430141MsoListParagraph gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg">Then, vm1 event will arrive, the processor will create the vm1 vertex in the graph, it will update the host1 properties in the graph (because the host1
 details that are created in nova.instance are only its basic details such as: category, type, id, is_deleted, is_placeholder they host1 properties won’t be changed in the graph because those details are basic and can’t be changed), and then it will create
 an edge between vm1 and host1 (only the nova.instance knows to which nova.host it is connected and not vice versa).<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="m_-452732109767430141MsoListParagraph gmail_msg"><u class="gmail_msg"></u><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg"><span class="gmail_msg">2.<span style="font:7.0pt "Times New Roman"" class="gmail_msg">      
</span></span></span><u class="gmail_msg"></u><span dir="LTR" class="gmail_msg"></span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg">Vm1 event arrives before host1.<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="m_-452732109767430141MsoListParagraph gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg">In this case the processor will add vm1 to the graph, then it will add the host1 placeholder to the graph (so we will know to which host vm1 is connected)
 and then add the edge between them.<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="m_-452732109767430141MsoListParagraph gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg">Then when the processor will handle with the host1 event, it will just add some properties of the host1 vertex, and of course will change the is_placeholder
 property of host1 to false.<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="m_-452732109767430141MsoListParagraph gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg">We also has the consistency service that runs every 10 minutes (its configurable with the snapshot_interval) and checks if there are vertices that are
 is_placeholder=True and are in the graph more then 2*snapshot_interval time then it means that such a vertex of host1 for example doesn’t really exists and it deletes it from the graph).
<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="m_-452732109767430141MsoListParagraph gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg">In addition, when we understand that we need to delete some entity from the graph, upon delete notification for example, then we don’t delete it right
 away, we change the is_deleted property of that entity to True, and we will delete it on the next run of the consistency service. The reason we do that, is because we need it for the evaluator, because it runs a subgraph matching algorithm on the graph, and
 if the entity that is supposed to be there doesn’t appear then it won’t work correctly.<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg">The best way to create a placeholder is to call the placeholder method of the correct transformer using the transformers array that each transformer class has.<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg">I hope this helps.<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg">Alexey<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt" class="gmail_msg">
<div class="gmail_msg">
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in" class="gmail_msg">
<p class="MsoNormal gmail_msg"><b class="gmail_msg"><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"" class="gmail_msg">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"" class="gmail_msg"> Yujun Zhang [mailto:<a href="mailto:zhangyujun%2Bzte@gmail.com" class="gmail_msg" target="_blank">zhangyujun+zte@gmail.com</a>]
<br class="gmail_msg">
<b class="gmail_msg">Sent:</b> Wednesday, December 14, 2016 10:55 AM<br class="gmail_msg">
<b class="gmail_msg">To:</b> OpenStack Development Mailing List (not for usage questions)<br class="gmail_msg">
<b class="gmail_msg">Subject:</b> [ALU] [openstack-dev] [vitrage] how to use placeholder vertex<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
</div>
</div></div></div></div><div lang="EN-US" link="blue" vlink="purple" class="gmail_msg"><div class="m_-452732109767430141WordSection1 gmail_msg"><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt" class="gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">Hi, root causers (assuming this nickname has been agreed)<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">It seems the placeholder is created for every neighbor of an entity[1]. I'm not sure what will happen if the neighbor entity has been created before. <u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">Will the graph utility handle it? Or we need to check the existence in transformer and deal with it?<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">Similar question for how to create a vertex when there is already a placeholder with same ID<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">[1]: <a href="https://github.com/openstack/vitrage/blob/master/vitrage/datasources/static_physical/transformer.py#L114" class="gmail_msg" target="_blank">https://github.com/openstack/vitrage/blob/master/vitrage/datasources/static_physical/transformer.py#L114</a> <u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">--<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">Yujun<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
</div>
</div></div></div><div lang="EN-US" link="blue" vlink="purple" class="gmail_msg"><div class="m_-452732109767430141WordSection1 gmail_msg"><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt" class="gmail_msg"></div>
</div>
</div>

__________________________________________________________________________<br class="gmail_msg">
OpenStack Development Mailing List (not for usage questions)<br class="gmail_msg">
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" class="gmail_msg" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br class="gmail_msg">
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br class="gmail_msg">
</blockquote></div>