diff options
author | Avra Sengupta <asengupt@redhat.com> | 2016-07-22 11:40:32 +0530 |
---|---|---|
committer | Rajesh Joseph <rjoseph@redhat.com> | 2016-08-01 23:19:02 -0700 |
commit | 69029a8e1d9ebc5150a0eeb2b3faa6481c409965 (patch) | |
tree | a775c19e1be01b6ab5f7eea2226daadbaf374132 | |
parent | 6614d7b86a610ccb20901239ed637e437ed73bd1 (diff) |
snapshot/snapd: Don't display pid when snapd is offline
Backport of http://review.gluster.org/#/c/14981/
We were previously reading the pidfile, and displaying
the pid even if snapd daemon is not running. Now to fix
it, we re-assign pid value to -1, if snapd is offline.
> Reviewed-on: http://review.gluster.org/14981
> Tested-by: Vijay Bellur <vbellur@redhat.com>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
(cherry picked from commit ec6925a379c7bee071df1638bc2751b266cee346)
Change-Id: I4baff8d489fe9380061c52aea006db90fa421cd7
BUG: 1360985
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/15033
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
-rwxr-xr-x[-rw-r--r--] | tests/bugs/snapshot/bug-1111041.t | 6 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/tests/bugs/snapshot/bug-1111041.t b/tests/bugs/snapshot/bug-1111041.t index 9188880912c..f771d64f2a3 100644..100755 --- a/tests/bugs/snapshot/bug-1111041.t +++ b/tests/bugs/snapshot/bug-1111041.t @@ -29,4 +29,10 @@ SNAPD_PID=$($CLI volume status $V0 | grep "Snapshot Daemon" | awk {'print $8'}); TEST [ $SNAPD_PID -gt 0 ] +kill -9 $SNAPD_PID + +SNAPD_PID=$($CLI volume status $V0 | grep "Snapshot Daemon" | awk {'print $8'}); + +TEST [ $SNAPD_PID = 'N/A' ] + cleanup ; diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c index 46c8bad1aa9..36adb7fbfd8 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c @@ -2051,6 +2051,8 @@ glusterd_add_snapd_to_dict (glusterd_volinfo_t *volinfo, glusterd_svc_build_snapd_pidfile (volinfo, pidfile, sizeof (pidfile)); brick_online = gf_is_service_running (pidfile, &pid); + if (brick_online == _gf_false) + pid = -1; memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "%s.pid", base_key); |