[ovs-dev] [PATCH] ovs-xapi-sync: Rerun processing when a db update arrives during a commit.

Justin Pettit jpettit at nicira.com
Thu Mar 8 19:40:38 UTC 2012


It looks good to me.

--Justin


On Mar 8, 2012, at 11:12 AM, Ben Pfaff wrote:

> The logic in ovs-xapi-sync didn't handle the case where ovsdb-server sends
> a database update before it replies to a transaction that ovs-xapi-sync
> sent, like this:
> 
> ovs-xapi-sync              ovsdb-server
> -------------              ------------
> 
>                      .
>                      .
>                      .
> transaction request  --->
>                     <---  database contents update
>                     <---  transaction reply
>                      .
>                      .
>                      .
> 
> The update was not lost but ovs-xapi-sync would not process it until the
> database changed again.
> 
> Bug #10082.
> Reported-by: Krishna Miriyala <krishna at nicira.com>
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
> It's too easy to get this wrong, so I'm working on some patches
> that make it harder.  In the meantime, I believe that this fixes
> the observed problem.
> 
> Thanks,
> 
> Ben.
> 
> .../usr_share_openvswitch_scripts_ovs-xapi-sync    |    5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync
> index 7132726..0ffccc2 100755
> --- a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync
> +++ b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync
> @@ -272,8 +272,10 @@ def main():
>     bridges = {}                # Map from bridge name to xs_network_uuids
>     iface_ids = {}              # Map from xs-vif-uuid to iface-id
>     vm_ids = {}                 # Map from xs-vm-uuid to vm-id
> +    seqno = idl.change_seqno    # Sequence number when we last processed the db
>     while True:
> -        if not force_run and not idl.run():
> +        idl.run()
> +        if not force_run and seqno == idl.change_seqno:
>             poller = ovs.poller.Poller()
>             idl.wait(poller)
>             poller.block()
> @@ -285,6 +287,7 @@ def main():
>             iface_ids = {}
>             vm_ids = {}
>             force_run = False
> +        seqno = idl.change_seqno
> 
>         txn = ovs.db.idl.Transaction(idl)
> 
> -- 
> 1.7.2.5
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev




More information about the dev mailing list