]> git.proxmox.com Git - ovs.git/commitdiff
ovn-ctl: Fix the wrong pidfile argument passed to ovsdb-servers
authorNuman Siddique <nusiddiq@redhat.com>
Tue, 9 Oct 2018 07:17:11 +0000 (12:47 +0530)
committerBen Pfaff <blp@ovn.org>
Thu, 11 Oct 2018 21:14:35 +0000 (14:14 -0700)
When OVN db servers are started usinb ovn-ctl, if the pid files
(/var/run/openvswitch/ovnnb_db.pid for example) are already
present, then ovn-ctl passes "--pidfile=123" if the pid file has
'123' stored in it. Later on when OVN pacemaker RA script calls
status_ovnnb/status_ovnsb() functions, these returns "not running".

The shell function 'pidfile_is_running()' stores the contents of
the pid file as  "pid=`cat "$pidfile"`". If the caller also
uses the same variable "pid" to store the file name, it gets
overriden.

This patch fixes this issue by renaming the local variable "pid"
in the "start_ovsdb__()" shell function to "db_file_name".

Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
ovn/utilities/ovn-ctl

index d71071a49e32a85f62d906dfda67d0a7dabb2e31..1e369b1f572676a58edd08d03055e8dd378a4cd6 100755 (executable)
@@ -95,7 +95,7 @@ promote_ovnsb() {
 
 start_ovsdb__() {
     local DB=$1 db=$2 schema_name=$3 table_name=$4
-    local pid
+    local db_pid_file
     local cluster_local_addr
     local cluster_local_port
     local cluster_local_proto
@@ -119,7 +119,7 @@ start_ovsdb__() {
     local ovn_db_ssl_key
     local ovn_db_ssl_cert
     local ovn_db_ssl_cacert
-    eval pid=\$DB_${DB}_PID
+    eval db_pid_file=\$DB_${DB}_PID
     eval cluster_local_addr=\$DB_${DB}_CLUSTER_LOCAL_ADDR
     eval cluster_local_port=\$DB_${DB}_CLUSTER_LOCAL_PORT
     eval cluster_local_proto=\$DB_${DB}_CLUSTER_LOCAL_PROTO
@@ -145,7 +145,7 @@ start_ovsdb__() {
     eval ovn_db_ssl_cacert=\$OVN_${DB}_DB_SSL_CA_CERT
 
     # Check and eventually start ovsdb-server for DB
-    if pidfile_is_running $pid; then
+    if pidfile_is_running $db_pid_file; then
         return
     fi
 
@@ -175,7 +175,7 @@ $cluster_remote_port
 
     set ovsdb-server
     set "$@" $log --log-file=$logfile
-    set "$@" --remote=punix:$sock --pidfile=$pid
+    set "$@" --remote=punix:$sock --pidfile=$db_pid_file
     set "$@" --unixctl=ovn${db}_db.ctl
 
     [ "$OVS_USER" != "" ] && set "$@" --user "$OVS_USER"