From b58d7ac109938ceb88ff4d7197a94c6c2af38c63 Mon Sep 17 00:00:00 2001 From: Numan Siddique Date: Mon, 17 Feb 2020 11:23:45 +0530 Subject: [PATCH] ovn-ctl: Provide the option to configure inactive probe from standby to active. Recently ovsdb-server supported an unixctl command - ovsdb-server/set-active-ovsdb-server-probe-interval to configure inactive probe interval from standby connection to the active. This patch provides the option to configure this from ovn-ctl and the pacemaker OVN OCF script. Signed-off-by: Numan Siddique Acked-by: Han Zhou (cherry-picked from upstream OVN repo commit 9991e91e7d592cef533b57af4405405ed5b41866) Conflicts: ovn/utilities/ovn-ctl Change-Id: I83a8f6e8d86836ed31946efc4aad5c07027f6d08 --- ovn/utilities/ovn-ctl | 6 ++++++ ovn/utilities/ovn-ctl.8.xml | 8 ++++++-- ovn/utilities/ovndb-servers.ocf | 23 +++++++++++++++++++---- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/ovn/utilities/ovn-ctl b/ovn/utilities/ovn-ctl index 65f03e28d..e2c5e5b0e 100755 --- a/ovn/utilities/ovn-ctl +++ b/ovn/utilities/ovn-ctl @@ -63,6 +63,7 @@ demote_ovnnb() { if test -e $ovnnb_active_conf_file; then ovs-appctl -t $OVN_RUNDIR/ovnnb_db.ctl ovsdb-server/set-active-ovsdb-server `cat $ovnnb_active_conf_file` ovs-appctl -t $OVN_RUNDIR/ovnnb_db.ctl ovsdb-server/connect-active-ovsdb-server + ovs-appctl -t $OVN_RUNDIR/ovnnb_db.ctl ovsdb-server/set-active-ovsdb-server-probe-interval $DB_NB_PROBE_INTERVAL_TO_ACTIVE else echo >&2 "$0: active server details not set" exit 1 @@ -77,6 +78,7 @@ demote_ovnsb() { if test -e $ovnsb_active_conf_file; then ovs-appctl -t $OVN_RUNDIR/ovnsb_db.ctl ovsdb-server/set-active-ovsdb-server `cat $ovnsb_active_conf_file` ovs-appctl -t $OVN_RUNDIR/ovnsb_db.ctl ovsdb-server/connect-active-ovsdb-server + ovs-appctl -t $OVN_RUNDIR/ovnsb_db.ctl ovsdb-server/set-active-ovsdb-server-probe-interval $DB_SB_PROBE_INTERVAL_TO_ACTIVE else echo >&2 "$0: active server details not set" exit 1 @@ -454,6 +456,7 @@ set_defaults () { DB_NB_SYNC_FROM_PROTO=tcp DB_NB_SYNC_FROM_ADDR= DB_NB_SYNC_FROM_PORT=6641 + DB_NB_PROBE_INTERVAL_TO_ACTIVE=60000 DB_SB_SOCK=$OVN_RUNDIR/ovnsb_db.sock DB_SB_PID=$OVN_RUNDIR/ovnsb_db.pid @@ -463,6 +466,7 @@ set_defaults () { DB_SB_SYNC_FROM_PROTO=tcp DB_SB_SYNC_FROM_ADDR= DB_SB_SYNC_FROM_PORT=6642 + DB_SB_PROBE_INTERVAL_TO_ACTIVE=60000 DB_NB_SCHEMA=$datadir/ovn-nb.ovsschema DB_SB_SCHEMA=$datadir/ovn-sb.ovsschema @@ -628,10 +632,12 @@ File location options: --db-nb-sync-from-port=PORT OVN Northbound active db tcp port (default: $DB_NB_SYNC_FROM_PORT) --db-nb-sync-from-proto=PROTO OVN Northbound active db transport (default: $DB_NB_SYNC_FROM_PROTO) --db-nb-create-insecure-remote=yes|no Create ptcp OVN Northbound remote (default: $DB_NB_CREATE_INSECURE_REMOTE) + --db-nb-probe-interval-to-active Active probe interval from standby to active ovsdb-server remote (default: $DB_NB_PROBE_INTERVAL_TO_ACTIVE) --db-sb-sync-from-addr=ADDR OVN Southbound active db tcp address (default: $DB_SB_SYNC_FROM_ADDR) --db-sb-sync-from-port=ADDR OVN Southbound active db tcp port (default: $DB_SB_SYNC_FROM_PORT) --db-sb-sync-from-proto=PROTO OVN Southbound active db transport (default: $DB_SB_SYNC_FROM_PROTO) --db-sb-create-insecure-remote=yes|no Create ptcp OVN Southbound remote (default: $DB_SB_CREATE_INSECURE_REMOTE) + --db-sb-probe-interval-to-active Active probe interval from standby to active ovsdb-server remote (default: $DB_SB_PROBE_INTERVAL_TO_ACTIVE) --db-nb-cluster-local-addr=ADDR OVN_Northbound cluster local address \ (default: $DB_NB_CLUSTER_LOCAL_ADDR) --db-nb-cluster-local-port=PORT OVN_Northbound cluster local tcp port \ diff --git a/ovn/utilities/ovn-ctl.8.xml b/ovn/utilities/ovn-ctl.8.xml index c5294d794..f0b3d6c87 100644 --- a/ovn/utilities/ovn-ctl.8.xml +++ b/ovn/utilities/ovn-ctl.8.xml @@ -94,6 +94,10 @@

--db-sb-cluster-remote-port=PORT NUMBER

--db-sb-cluster-remote-proto=PROTO (tcp/ssl)

+

Probe interval options

+

--db-nb-probe-interval-to-active=Time in milliseconds

+

--db-sb-probe-interval-to-active=Time in milliseconds

+

Configuration files

Following are the optional configuration files. If present, it should be located in the etc dir

@@ -150,8 +154,8 @@

Promote and demote ovsdb servers

# ovn-ctl promote_ovnnb

# ovn-ctl promote_ovnsb

-

# ovn-ctl --db-nb-sync-from-addr=x.x.x.x --db-nb-sync-from-port=6641 demote_ovnnb

-

# ovn-ctl --db-sb-sync-from-addr=x.x.x.x --db-sb-sync-from-port=6642 demote_ovnsb

+

# ovn-ctl --db-nb-sync-from-addr=x.x.x.x --db-nb-sync-from-port=6641 --db-nb-probe-interval-to-active=60000 demote_ovnnb

+

# ovn-ctl --db-sb-sync-from-addr=x.x.x.x --db-sb-sync-from-port=6642 --db-sb-probe-interval-to-active=60000 demote_ovnsb

Creating a clustered db on 3 nodes with IPs x.x.x.x, y.y.y.y and z.z.z.z

Starting OVN ovsdb servers and ovn-northd on the node with IP x.x.x.x

diff --git a/ovn/utilities/ovndb-servers.ocf b/ovn/utilities/ovndb-servers.ocf index cd4742668..1737b192e 100755 --- a/ovn/utilities/ovndb-servers.ocf +++ b/ovn/utilities/ovndb-servers.ocf @@ -9,6 +9,7 @@ : ${SB_MASTER_PROTO_DEFAULT="tcp"} : ${MANAGE_NORTHD_DEFAULT="no"} : ${INACTIVE_PROBE_DEFAULT="5000"} +: ${INACTIVE_PROBE_TO_MASTER_DEFAULT="60000"} : ${LISTEN_ON_MASTER_IP_ONLY_DEFAULT="yes"} : ${NB_SSL_KEY_DEFAULT="/etc/openvswitch/ovnnb-privkey.pem"} : ${NB_SSL_CERT_DEFAULT="/etc/openvswitch/ovnnb-cert.pem"} @@ -27,6 +28,7 @@ SB_MASTER_PORT=${OCF_RESKEY_sb_master_port:-${SB_MASTER_PORT_DEFAULT}} SB_MASTER_PROTO=${OCF_RESKEY_sb_master_protocol:-${SB_MASTER_PROTO_DEFAULT}} MANAGE_NORTHD=${OCF_RESKEY_manage_northd:-${MANAGE_NORTHD_DEFAULT}} INACTIVE_PROBE=${OCF_RESKEY_inactive_probe_interval:-${INACTIVE_PROBE_DEFAULT}} +INACTIVE_PROBE_TO_MASTER=${OCF_RESKEY_inactive_probe_interval_to_master:-${INACTIVE_PROBE_TO_MASTER_DEFAULT}} NB_PRIVKEY=${OCF_RESKEY_ovn_nb_db_privkey:-${NB_SSL_KEY_DEFAULT}} NB_CERT=${OCF_RESKEY_ovn_nb_db_cert:-${NB_SSL_CERT_DEFAULT}} NB_CACERT=${OCF_RESKEY_ovn_nb_db_cacert:-${NB_SSL_CACERT_DEFAULT}} @@ -135,6 +137,15 @@ ovsdb_server_metadata() { + + + Inactive probe interval to use for the connection from standby + ovsdb-server to master ovsdb-server. + + Set inactive probe interval to master + + + If set to yes, the OVNDBs will listen on master IP. Otherwise, it will @@ -266,10 +277,12 @@ inactivity_probe=$INACTIVE_PROBE -- set SB_Global . connections=@conn_uuid 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} \ --db-nb-sync-from-port=${NB_MASTER_PORT} \ - --db-nb-sync-from-proto=${NB_MASTER_PROTO} + --db-nb-sync-from-proto=${NB_MASTER_PROTO} \ + --db-nb-probe-interval-to-active=${INACTIVE_PROBE_TO_MASTER} ${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} + --db-sb-sync-from-proto=${SB_MASTER_PROTO} \ + --db-sb-probe-interval-to-active=${INACTIVE_PROBE_TO_MASTER} fi } @@ -596,10 +609,12 @@ ovsdb_server_demote() { # being demoted. Sync to the surviving one ${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} + --db-nb-sync-from-proto=${NB_MASTER_PROTO} \ + --db-nb-probe-interval-to-active=${INACTIVE_PROBE_TO_MASTER} ${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} + --db-sb-sync-from-proto=${SB_MASTER_PROTO} \ + --db-sb-probe-interval-to-active=${INACTIVE_PROBE_TO_MASTER} else # For completeness, should never be called -- 2.25.1