12a457
From f6d6ff4a01706b6c61507ad8775f08b6b99787b7 Mon Sep 17 00:00:00 2001
12a457
From: Avra Sengupta <asengupt@redhat.com>
12a457
Date: Thu, 10 Mar 2016 14:32:03 +0530
12a457
Subject: [PATCH 28/80] snapshot: Use svc->manager during glusterd restart
12a457
12a457
Instead of using svc->start, we should use svc->manager
12a457
as it takes care of initializing svc too, and both starts
12a457
and stops snapd as needed.
12a457
12a457
Change-Id: I3d3afdf4c4203bee3b790a017b820339fd376af6
12a457
BUG: 1289439
12a457
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
12a457
Reviewed-on: http://review.gluster.org/13665
12a457
Smoke: Gluster Build System <jenkins@build.gluster.com>
12a457
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
12a457
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
12a457
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
12a457
Reviewed-on: https://code.engineering.redhat.com/gerrit/70553
12a457
Tested-by: Rajesh Joseph <rjoseph@redhat.com>
12a457
---
12a457
 tests/bugs/snapshot/bug-1316437.t              |   30 ++++++++++++++++++++++++
12a457
 xlators/mgmt/glusterd/src/glusterd-snapd-svc.c |    9 +++----
12a457
 2 files changed, 34 insertions(+), 5 deletions(-)
12a457
 create mode 100644 tests/bugs/snapshot/bug-1316437.t
12a457
12a457
diff --git a/tests/bugs/snapshot/bug-1316437.t b/tests/bugs/snapshot/bug-1316437.t
12a457
new file mode 100644
12a457
index 0000000..30a221e
12a457
--- /dev/null
12a457
+++ b/tests/bugs/snapshot/bug-1316437.t
12a457
@@ -0,0 +1,30 @@
12a457
+#!/bin/bash
12a457
+
12a457
+. $(dirname $0)/../../include.rc
12a457
+. $(dirname $0)/../../volume.rc
12a457
+. $(dirname $0)/../../snapshot.rc
12a457
+
12a457
+cleanup;
12a457
+
12a457
+TEST glusterd
12a457
+
12a457
+# Intentionally not carving lvms for this as we will not be taking
12a457
+# snapshots in this testcase
12a457
+TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{1,2,3,4,5,6};
12a457
+
12a457
+TEST $CLI volume start $V0;
12a457
+
12a457
+TEST $CLI volume set $V0 features.uss enable;
12a457
+
12a457
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Y' check_if_snapd_exist
12a457
+
12a457
+killall glusterd glusterfsd glusterfs
12a457
+
12a457
+SNAPD_PID=$(ps auxww | grep snapd | grep -v grep | awk '{print $2}');
12a457
+TEST ! [ $SNAPD_PID -gt 0 ];
12a457
+
12a457
+glusterd
12a457
+
12a457
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Y' check_if_snapd_exist
12a457
+
12a457
+cleanup;
12a457
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
12a457
index 993419c..71188eb 100644
12a457
--- a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
12a457
+++ b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
12a457
@@ -359,15 +359,14 @@ glusterd_snapdsvc_restart ()
12a457
 
12a457
         cds_list_for_each_entry (volinfo, &conf->volumes, vol_list) {
12a457
                 /* Start per volume snapd svc */
12a457
-                if (volinfo->status == GLUSTERD_STATUS_STARTED &&
12a457
-                    glusterd_is_snapd_enabled (volinfo)) {
12a457
+                if (volinfo->status == GLUSTERD_STATUS_STARTED) {
12a457
                         svc = &(volinfo->snapd.svc);
12a457
-                        ret = svc->start (svc, PROC_START_NO_WAIT);
12a457
+                        ret = svc->manager (svc, volinfo, PROC_START_NO_WAIT);
12a457
                         if (ret) {
12a457
                                 gf_msg (this->name, GF_LOG_ERROR, 0,
12a457
                                         GD_MSG_SNAPD_START_FAIL,
12a457
-                                        "Couldn't start snapd for "
12a457
-                                        "vol: %s", volinfo->volname);
12a457
+                                        "Couldn't resolve snapd for "
12a457
+                                        "vol: %s on restart", volinfo->volname);
12a457
                                 goto out;
12a457
                         }
12a457
                 }
12a457
-- 
12a457
1.7.1
12a457