From patchwork Wed Jan 11 12:11:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guoshuai Li X-Patchwork-Id: 713725 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3tz77K67sDz9ssP for ; Wed, 11 Jan 2017 23:12:29 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2E620B35; Wed, 11 Jan 2017 12:12:26 +0000 (UTC) X-Original-To: ovs-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 F1F0BA88 for ; Wed, 11 Jan 2017 12:12:23 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from smtp2203-239.mail.aliyun.com (smtp2203-239.mail.aliyun.com [121.197.203.239]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id 43C9A12C for ; Wed, 11 Jan 2017 12:12:20 +0000 (UTC) X-Alimail-AntiSpam: AC=CONTINUE; BC=0.074477|-1; FP=0|0|0|0|0|-1|-1|-1; HT=e02c03301; MF=ligs@dtdream.com; NM=1; PH=DS; RN=2; RT=2; SR=0; TI=SMTPD_---.7QmtIjl_1484136701; Received: from localhost.localdomain(mailfrom:ligs@dtdream.com ip:111.198.29.132) by smtp.aliyun-inc.com(10.147.42.253); Wed, 11 Jan 2017 20:11:42 +0800 From: Guoshuai Li To: ovs-dev@openvswitch.org Date: Wed, 11 Jan 2017 20:11:33 +0800 Message-Id: <20170111121133.10680-1-ligs@dtdream.com> X-Mailer: git-send-email 2.10.1.windows.1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY 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] ovn: fix slave node can not connect to the master node using SSL, for pacemaker 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 The default slave node connect to the master node using TCP, and the pacemaker can not modify the protocol and port of the connection. Add pacemaker parameters to support the connection of the slave node to the master node using a different protocol and port. Signed-off-by: Guoshuai Li Acked-by: Andy Zhou --- Documentation/topics/integration.rst | 5 ++- ovn/utilities/ovndb-servers.ocf | 60 +++++++++++++++++++++++++++++++++--- 2 files changed, 60 insertions(+), 5 deletions(-) diff --git a/Documentation/topics/integration.rst b/Documentation/topics/integration.rst index 2f4043e..b4e2517 100644 --- a/Documentation/topics/integration.rst +++ b/Documentation/topics/integration.rst @@ -231,7 +231,10 @@ active and multiple backup servers for OVN databases:: The `master_ip` and `ovn_ctl` are the parameters that will be used by the OCF script. `ovn_ctl` is optional, if not given, it assumes a default value of /usr/share/openvswitch/scripts/ovn-ctl. `master_ip` is the IP address on which -the active database server is expected to be listening. +the active database server is expected to be listening, the slave node uses it +to connect to the master node. You can add the optional parameters +'nb_master_port', 'nb_master_protocol', 'sb_master_port', 'sb_master_protocol' +to set the protocol and port. Whenever the active server dies, pacemaker is responsible to promote one of the backup servers to be active. Both ovn-controller and ovn-northd needs the diff --git a/ovn/utilities/ovndb-servers.ocf b/ovn/utilities/ovndb-servers.ocf index 1cf6f20..ad4b155 100755 --- a/ovn/utilities/ovndb-servers.ocf +++ b/ovn/utilities/ovndb-servers.ocf @@ -3,10 +3,18 @@ : ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat} . ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs : ${OVN_CTL_DEFAULT="/usr/share/openvswitch/scripts/ovn-ctl"} +: ${NB_MASTER_PORT_DEFAULT="6641"} +: ${NB_MASTER_PROTO_DEFAULT="tcp"} +: ${SB_MASTER_PORT_DEFAULT="6642"} +: ${SB_MASTER_PROTO_DEFAULT="tcp"} CRM_MASTER="${HA_SBIN_DIR}/crm_master -l reboot" CRM_ATTR_REPL_INFO="${HA_SBIN_DIR}/crm_attribute --type crm_config --name OVN_REPL_INFO -s ovn_ovsdb_master_server" OVN_CTL=${OCF_RESKEY_ovn_ctl:-${OVN_CTL_DEFAULT}} MASTER_IP=${OCF_RESKEY_master_ip} +NB_MASTER_PORT=${OCF_RESKEY_nb_master_port:-${NB_MASTER_PORT_DEFAULT}} +NB_MASTER_PROTO=${OCF_RESKEY_nb_master_protocol:-${NB_MASTER_PROTO_DEFAULT}} +SB_MASTER_PORT=${OCF_RESKEY_sb_master_port:-${SB_MASTER_PORT_DEFAULT}} +SB_MASTER_PROTO=${OCF_RESKEY_sb_master_protocol:-${SB_MASTER_PROTO_DEFAULT}} # Invalid IP address is an address that can never exist in the network, as # mentioned in rfc-5737. The ovsdb servers connects to this IP address till @@ -50,6 +58,38 @@ ovsdb_server_metadata() { + + + The port which the master Northbound database server is listening + + master Northbound database port + + + + + + The protocol which the master Northbound database server used, 'tcp' or 'ssl'. + + master Northbound database protocol + + + + + + The port which the master Southbound database server is listening + + master Southbound database port + + + + + + The protocol which the master Southbound database server used, 'tcp' or 'ssl'. + + master Southbound database protocol + + + @@ -86,8 +126,12 @@ ovsdb_server_notify() { else # Synchronize with the new master ocf_log debug "ovndb_server: Connecting to the new master ${OCF_RESKEY_CRM_meta_notify_promote_uname}" - ${OVN_CTL} demote_ovnnb --db-nb-sync-from-addr=${MASTER_IP} - ${OVN_CTL} demote_ovnsb --db-sb-sync-from-addr=${MASTER_IP} + ${OVN_CTL} demote_ovnnb --db-nb-sync-from-addr=${MASTER_IP} \ + --db-nb-sync-from-port=${NB_MASTER_PORT} \ + --db-nb-sync-from-proto=${NB_MASTER_PROTO} + ${OVN_CTL} demote_ovnsb --db-sb-sync-from-addr=${MASTER_IP} \ + --db-sb-sync-from-port=${SB_MASTER_PORT} \ + --db-sb-sync-from-proto=${SB_MASTER_PROTO} fi } @@ -206,6 +250,10 @@ ovsdb_server_start() { elif [ ${present_master} != ${host_name} ]; then # An existing master is active, connect to it set $@ --db-nb-sync-from-addr=${MASTER_IP} --db-sb-sync-from-addr=${MASTER_IP} + set $@ --db-nb-sync-from-port=${NB_MASTER_PORT} + set $@ --db-nb-sync-from-proto=${NB_MASTER_PROTO} + set $@ --db-sb-sync-from-port=${SB_MASTER_PORT} + set $@ --db-sb-sync-from-proto=${SB_MASTER_PROTO} fi $@ start_ovsdb @@ -314,8 +362,12 @@ ovsdb_server_demote() { elif [ "x${present_master}" != x ]; then # There are too many masters and we're an extra one that is # being demoted. Sync to the surviving one - ${OVN_CTL} demote_ovnnb --db-nb-sync-from-addr=${MASTER_IP} - ${OVN_CTL} demote_ovnsb --db-sb-sync-from-addr=${MASTER_IP} + ${OVN_CTL} demote_ovnnb --db-nb-sync-from-addr=${MASTER_IP} \ + --db-nb-sync-from-port=${NB_MASTER_PORT} \ + --db-nb-sync-from-proto=${NB_MASTER_PROTO} + ${OVN_CTL} demote_ovnsb --db-sb-sync-from-addr=${MASTER_IP} \ + --db-sb-sync-from-port=${SB_MASTER_PORT} \ + --db-sb-sync-from-proto=${SB_MASTER_PROTO} else # For completeness, should never be called