From patchwork Tue Aug 7 11:37:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 954485 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41lCDh1SP1z9ryt for ; Tue, 7 Aug 2018 21:37:37 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2C4109D7; Tue, 7 Aug 2018 11:37:34 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 386429D3 for ; Tue, 7 Aug 2018 11:37:33 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id B987E764 for ; Tue, 7 Aug 2018 11:37:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C774087A70 for ; Tue, 7 Aug 2018 11:37:31 +0000 (UTC) Received: from nusiddiq.redhat (ovpn-117-27.sin2.redhat.com [10.67.117.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 491A810075DD; Tue, 7 Aug 2018 11:37:29 +0000 (UTC) From: nusiddiq@redhat.com To: dev@openvswitch.org Date: Tue, 7 Aug 2018 17:07:19 +0530 Message-Id: <20180807113719.2959-1-nusiddiq@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 07 Aug 2018 11:37:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 07 Aug 2018 11:37:31 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'nusiddiq@redhat.com' RCPT:'' X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v4 0/2] Partial cluster support in Python IDL client X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Numan Siddique Python IDL library is lacking the functionality to connect to the clustered db servers by providing multiple remotes (like - "tcp:10.0.0.1:6641, tcp:10.0.0.2:6641, tcp:10.0.0.3:6641") in the connection string. This patch adds this functionality to the python idl library. It still lacks the feature to connect to the master of the cluster. To add this - python idl client should monitor and read the '_Server' schema - connect to the master of the cluster. I will submit the patch once that is ready. But for now I think this is good enough for the clients to connect to the cluster dbs. v3 -> v4 -------- p1 -> As per Ben's suggestion, used the select.poll() to know the connection status. In case eventlet/gevent is used and select.poll is monkey patched, then get the original select.poll() using eventlet.patcher.original/gevent.monkey.get_original functions. v2 -> v3 -------- Addressed the review comments from Ben to parse the remote in db/idl.py v1 -> v2 -------- Deleted the debug code which I forgot to cleanup when sending v1. Numan Siddique (2): ovs python: ovs.stream.open_block() returns success even if the remote is unreachable python jsonrpc: Allow jsonrpc_session to have more than one remote. python/ovs/db/idl.py | 20 ++++++++++- python/ovs/jsonrpc.py | 39 +++++++++++++++++----- python/ovs/poller.py | 34 +++++++++++++++++-- python/ovs/socket_util.py | 6 ++-- python/ovs/stream.py | 11 ++++-- tests/automake.mk | 1 + tests/ovsdb-idl.at | 70 +++++++++++++++++++++++++++++++++++++++ tests/test-ovsdb.py | 13 ++++++-- tests/test-stream.py | 32 ++++++++++++++++++ 9 files changed, 208 insertions(+), 18 deletions(-) create mode 100644 tests/test-stream.py Acked-by: Mark Michelson