diff options
author | Michele Baldessari <michele@acksyn.org> | 2019-08-14 17:47:07 +0200 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2019-08-29 07:41:44 -0700 |
commit | 308f0302c85eb4df480d8ee52a18aab0a6c79a45 (patch) | |
tree | 022074531061e9e3a2a77de14710833b7ba22fbb | |
parent | c83fc9dd43258769561d7206a27bbd828a960517 (diff) | |
download | openvswitch-308f0302c85eb4df480d8ee52a18aab0a6c79a45.tar.gz |
Make pid_exists() more robust against empty pid argument
In some of our destructive testing of ovn-dbs inside containers managed
by pacemaker we reached a situation where /var/run/openvswitch had
empty .pid files. The current code does not deal well with them
and pidfile_is_running() returns true in such a case and this confuses
the OCF resource agent.
- Before this change:
Inside a container run:
killall ovsdb-server;
echo -n '' > /var/run/openvswitch/ovnnb_db.pid; echo -n '' > /var/run/openvswitch/ovnsb_db.pid
We will observe that the cluster is unable to ever recover because
it believes the ovn processes to be running when they really aren't and
eventually just fails:
podman container set: ovn-dbs-bundle [192.168.24.1:8787/rhosp15/openstack-ovn-northd:pcmklatest]
ovn-dbs-bundle-0 (ocf::ovn:ovndb-servers): Master controller-0
ovn-dbs-bundle-1 (ocf::ovn:ovndb-servers): Stopped controller-1
ovn-dbs-bundle-2 (ocf::ovn:ovndb-servers): Slave controller-2
Let's make sure pid_exists() returns false when the pid is an empty
string.
- After this change the cluster is able to recover from this state and
correctly start the resource:
podman container set: ovn-dbs-bundle [192.168.24.1:8787/rhosp15/openstack-ovn-northd:pcmklatest]
ovn-dbs-bundle-0 (ocf::ovn:ovndb-servers): Master controller-0
ovn-dbs-bundle-1 (ocf::ovn:ovndb-servers): Slave controller-1
ovn-dbs-bundle-2 (ocf::ovn:ovndb-servers): Slave controller-2
Fixes: 3028ce2595c8 ("ovs-lib: Allow "status" command to work as non-root.")
Signed-off-by: Michele Baldessari <michele@acksyn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
-rw-r--r-- | utilities/ovs-lib.in | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in index 0b5f4ce50..fde8194f3 100644 --- a/utilities/ovs-lib.in +++ b/utilities/ovs-lib.in @@ -125,7 +125,7 @@ fi pid_exists () { # This is better than "kill -0" because it doesn't require permission to # send a signal (so daemon_status in particular works as non-root). - test -d /proc/"$1" + test -n "$1" && test -d /proc/"$1" } pid_comm_check () { |