Peng, I think you are right. We should have a common behavior among the drivers, and move the implementation to the proper methods like post-commits, do the validation on the pre-commits, etc, etc.
Second phase to tackle the out-of-sync could be the "revision number" approach from networking-ovn. Cheers On Mon, Dec 11, 2017 at 4:32 PM, Peng Liu <p...@redhat.com> wrote: > Hi Michael, > > Yes, it's a similar issue but different aspect. Actually, the case for > l2gw is worse, considering we have to deal with 2 existing back-end driver > which have different understanding for the interfaces. But I think the > proposed approach for networking-ovn is inspiring and helpful for l2gw. > > Thanks, > > On Fri, Dec 8, 2017 at 11:59 PM, Michael Bayer <mba...@redhat.com> wrote: > >> On Wed, Dec 6, 2017 at 3:46 AM, Peng Liu <p...@redhat.com> wrote: >> > Hi, >> > >> > During working on this patch[0], I encounter some DB out-of-sync >> problem. I >> > think maybe the design can be improved. Here is my thought, all >> comments are >> > welcome. >> >> >> see also https://review.openstack.org/#/c/490834/ which I think is >> dealing with a similar (if not the same) issue. >> >> > >> > In plugin code, I found all the resource operations follow the pattern >> in >> > [1]. It is a very misleading design compare to [2]. >> > >> > "For every action that can be taken on a resource, the mechanism driver >> > exposes two methods - ACTION_RESOURCE_precommit, which is called within >> the >> > database transaction context, and ACTION_RESOURCE_postcommit, called >> after >> > the database transaction is complete." >> > >> > In result, if we focus on the out-of-sync between plugin DB and >> > driver/backend DB: >> > >> > 1) In RPC driver, only methods Action_Resource and are implemented. >> Which >> > means the action is token before it was written in plugin DB. In case of >> > action partial succeed (especially for update case) or plugin DB >> operation >> > failure, it will cause DB out-of-sync. >> > 2) In ODL driver, only methods Action_Resource_postcommit are >> implemented, >> > which means there is no validation in ODL level before the record is >> written >> > in the plugin DB. In case of, ODL side failure, there is no rollback for >> > plugin DB. >> > >> > So, to fix this issue is costly. Both plugin and driver sides need to be >> > altered. >> > >> > The other side of this issue is a period db monitor mechanism between >> plugin >> > and drivers, and it is another story. >> > >> > >> > [0] https://review.openstack.org/#/c/516256 >> > [1] >> > ... >> > def Action_Resource >> > self.validate_Resource_for_Action >> > self.driver.Action_Resource >> > with context.session.begin(subtransactions=True): >> > super.Action_Resource >> > self.driver.Action_Resource_precommit >> > try: >> > self.driver.Action_Resource_postcommit >> > ... >> > [2] https://wiki.openstack.org/wiki/Neutron/ML2 >> > >> > -- >> > Peng Liu >> > >> > ____________________________________________________________ >> ______________ >> > OpenStack Development Mailing List (not for usage questions) >> > Unsubscribe: openstack-dev-requ...@lists.op >> enstack.org?subject:unsubscribe >> > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev >> > >> >> ____________________________________________________________ >> ______________ >> OpenStack Development Mailing List (not for usage questions) >> Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscrib >> e >> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev >> > > > > -- > Peng Liu | Senior Software Engineer > > Tel: +86 10 62608046 (direct) > Mobile: +86 13801193245 <+86%20138%200119%203245> > > Red Hat Software (Beijing) Co., Ltd. > 9/F, North Tower C, > Raycom Infotech Park, > No.2 Kexueyuan Nanlu, Haidian District, > Beijing, China, POC 100190 > > __________________________________________________________________________ > OpenStack Development Mailing List (not for usage questions) > Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > > -- Ricardo Noriega Senior Software Engineer - NFV Partner Engineer | Office of Technology | Red Hat irc: rnoriega @freenode
__________________________________________________________________________ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev