<div dir="ltr"><div class="gmail_default"><font face="arial, helvetica, sans-serif">Adding the proper tags in subject</font></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 13, 2016 at 1:22 PM, Numan Siddique <span dir="ltr"><<a href="mailto:nusiddiq@redhat.com" target="_blank">nusiddiq@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><font face="arial, helvetica, sans-serif">Hi Neutrinos,<br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Presently, In the OVN ML2 driver we have 2 ways to sync neutron DB and OVN DB</font></div><div><font face="arial, helvetica, sans-serif"> - At neutron-server startup, OVN ML2 driver syncs the neutron DB and OVN DB if sync mode is set to repair.</font></div><div><font face="arial, helvetica, sans-serif"> - Admin can run the "neutron-ovn-db-sync-util" to sync the DBs.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Recently, in the v2 of networking-odl ML2 driver (Please see (1) below which has more details). (ODL folks please correct me if I am wrong here)</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">  - a journal thread is created which does the CRUD operations of neutron resources asynchronously (i.e it sends the REST APIs to the ODL controller).</font></div><div><font face="arial, helvetica, sans-serif">  - a maintenance thread is created which does some cleanup periodically and at startup does full sync if it detects ODL controller cold reboot.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Few question I have</font></div><div><font face="arial, helvetica, sans-serif"> - can OVN ML2 driver take same or similar approach. Are there any advantages in taking this approach ? One advantage is neutron resources can be created/updated/deleted even if the OVN ML2 driver has lost connection to the ovsdb-server. The journal thread would eventually sync these resources in the OVN DB. I would like to know the communities thoughts on this.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"> - Are there are other ML2 drivers which might have to handle the DB sync's (cases where the other controllers also maintain their own DBs) and how they are handling it ?</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"> - Can a common approach be taken to sync the neutron DB and controller DBs ?</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">-----------------------------------------------------------------------------------------------------------</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">(1)</font></div><div><font face="arial, helvetica, sans-serif">Sync threads created by networking-odl ML2 driver</font></div><div><font face="arial, helvetica, sans-serif">--------------------------------------------------</font></div><div><font face="arial, helvetica, sans-serif">ODL ML2 driver creates 2 threads (threading.Thread module) at init</font></div><div><font face="arial, helvetica, sans-serif"> - Journal thread</font></div><div><font face="arial, helvetica, sans-serif"> - Maintenance thread</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Journal thread</font></div><div><font face="arial, helvetica, sans-serif">----------------</font></div><div><font face="arial, helvetica, sans-serif">The journal module creates a new journal table by name “opendaylightjournal”  - <a href="https://github.com/openstack/networking-odl/blob/master/networking_odl/db/models.py#L23" target="_blank">https://github.com/openstack/networking-odl/blob/master/networking_odl/db/models.py#L23</a></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Journal thread will be in loop waiting for the sync event from the ODL ML2 driver.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"> - ODL ML2 driver resource (network, subnet, port) precommit functions when called by the ML2 plugin adds an entry in the “opendaylightjournal” table with the resource data and sets the journal operation state for this entry to “PENDING”.</font></div><div><font face="arial, helvetica, sans-serif"> - The corresponding resource postcommit function of the ODL ML2 plugin when called, sets the sync event flag.</font></div><div><font face="arial, helvetica, sans-serif"> - A timer is also created which sets the sync event flag when it expires (the default value is 10 seconds).</font></div><div><font face="arial, helvetica, sans-serif"> - Journal thread wakes up, looks into the “opendaylightjournal” table with the entries with state “pending” and runs the CRUD operation on those resources in the ODL DB. Once done, it sets the state to “completed”.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Maintenance thread</font></div><div><font face="arial, helvetica, sans-serif">------------------</font></div><div><font face="arial, helvetica, sans-serif">Maintenance thread does 3 operations</font></div><div><font face="arial, helvetica, sans-serif"> - JournalCleanup - Delete completed rows from journal table “opendaylightjournal”.</font></div><div><font face="arial, helvetica, sans-serif"> - CleanupProcessing - Mark orphaned processing rows to pending.</font></div><div><font face="arial, helvetica, sans-serif"> - Full sync - Re-sync when detecting an ODL "cold reboot”.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Thanks</font></div><span class="HOEnZb"><font color="#888888"><div><font face="arial, helvetica, sans-serif">Numan</font></div><div style="font-family:monospace,monospace"><br></div></font></span></div></div>
</blockquote></div><br></div></div>