[ovs-dev] [PATCH V3] Add Passive TCP connection to IDL

Russell Bryant russell at ovn.org
Wed Jan 6 16:10:07 UTC 2016


On 12/31/2015 06:55 AM, Ofer Ben Yacov wrote:
> Currently the IDL does not support passive TCP connection,
> i.e. when the OVSDB connects to its manager.
> 
> This patch enables IDL to use an already-open session
> (the one which was previously used for retrieving the db schema).
> In addition, it enables IDL to go back to "listen mode" in case the connection
> is lost.
> 
> LIMITATIONS:
> ----------------------
> 
> This patch enables a **SINGLE** TCP connection from an OVSDB server to an
> agent that uses IDL with {IP,PORT} pair. Therefore, the agent will support
> only **ONE** OVSDB server using {IP,PORT} pair.
> 
> Future development may add multi-session server capability that will allow
> an agent to use single {IP,PORT} pair to connect to multiple OVSDB servers.
> 
> 
> CAVEAT:
> --------------
> 
> When a database first connects to the agent, the agent gets the schema and
> data and builds its tables. If the session disconnects, the agent goes back
> to "listen mode" and accepts **ANY** TCP connection, which means that if
> another database will try to connect to the agent using the same {IP,PORT}
> pair, it will be connected to the IDL that has the schema and data from
> the first database.
> 
> A future patch can resolve this problem.
> 
> USAGE:
> -------------
> 
> To use IDL in passive mode, the following example code can be use:
> 
> (snippet)
> 
> from ovs.jsonrpc import Session
> ...
> 
> from neutron.agent.ovsdb.native import idlutils
> 
> ...
> 
> session = Session.open('ptcp:192.168.10.10:6640')
> 
> # first call to session.run creates the PassiveStream object and second one
> # accept incoming connection
> session.run()
> session.run()
> 
> # this static method is similar to the original neutron method but the
> # rpc.close() command that would result closing the socket.
> helper = idlutils.get_schema_helper_from_stream_no_close(session.stream,
>         'hardware_vtep')
> helper.register_all()
> self.idl = idl.Idl(self.connection, helper, session)
> idlutils.wait_for_change(self.idl, self.timeout)
> 
> self.poller = poller.Poller()
> self.thread = threading.Thread(target=self.run)
> self.thread.setDaemon(True)
> self.thread.start()
> 
> 
> TESTING:
> ---------------
> Added unit test for passive mode. See ovsdb-idl.at file.
> 
> 
> Signed-off-by: "Ofer Ben-Yacov" <ofer.benyacov at gmail.com>
> 
> Tested-by: "Ofer Ben-Yacov" <ofer.benyacov at @gmail.com>

It looks like your email address got re-formatted here.

> Requested-by: Ben Pfaff <blp at nicira.com>, 
>         "D M, Vikas" <vikas.d-m at hpe.com>,
>         "Kamat, Maruti Haridas" <maruti.kamat at hpe.com>,
>         "Sukhdev Kapur" <sukhdev at arista.com>,
>         "Migliaccio, Armando" <armando.migliaccio at hpe.com>

Each email address should be on its own Requested-by line.

I'm not sure why, but I get an error trying to apply this patch even
though it looks like you sent it with git-send-email.

> Applying: Add Passive TCP connection to IDL
> /home/rbryant/src/ovs/.git/rebase-apply/patch:106: new blank line at EOF.
> +
> error: patch failed: python/ovs/stream.py:350
> error: python/ovs/stream.py: patch does not apply
> Patch failed at 0001 Add Passive TCP connection to IDL

Can you push the patch to github?  I can pull it down from there.

-- 
Russell Bryant



More information about the dev mailing list