summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2014-07-15 15:55:34 +0530
committerKaushal M <kaushal@redhat.com>2014-07-15 23:38:41 -0700
commitdcc1696045f12127ff37e6312a04c0024c8a4e24 (patch)
tree0c98cda316d9c121bae16af9275ca9cb3c5de9de
parent52ca745fb79d36d7587a7913639520c90a121168 (diff)
mgmt/glusterd: do not check for snapd handle in restore if uss is disabled
Change-Id: I01afe64685a5794cce9265580c6c5de57a045201 BUG: 1119582 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.org/8310 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaushal M <kaushal@redhat.com>
-rw-r--r--tests/bugs/bug-1119582.t24
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c19
2 files changed, 43 insertions, 0 deletions
diff --git a/tests/bugs/bug-1119582.t b/tests/bugs/bug-1119582.t
new file mode 100644
index 00000000000..9251927e314
--- /dev/null
+++ b/tests/bugs/bug-1119582.t
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+. $(dirname $0)/../fileio.rc
+. $(dirname $0)/../nfs.rc
+
+cleanup;
+
+TEST glusterd;
+
+TEST pidof glusterd;
+
+TEST $CLI volume create $V0 $H0:$B0/${V0}0 $H0:$B0/${V0}1
+
+TEST $CLI volume set $V0 features.uss disable;
+
+TEST killall glusterd;
+
+rm -f /var/lib/glusterd/vols/$V0/snapd.info
+
+TEST glusterd
+
+cleanup ;
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index 06e8101a3a5..3f241bbe53a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -2126,6 +2126,25 @@ glusterd_store_retrieve_snapd (glusterd_volinfo_t *volinfo)
goto out;
}
+ /*
+ * This is needed for upgrade situations. Say a volume is created with
+ * older version of glusterfs and upgraded to a glusterfs version equal
+ * to or greater than GD_OP_VERSION_3_6_0. The older glusterd would not
+ * have created the snapd.info file related to snapshot daemon for user
+ * serviceable snapshots. So as part of upgrade when the new glusterd
+ * starts, as part of restore (restoring the volume to be precise), it
+ * tries to snapd related info from snapd.info file. But since there was
+ * no such file till now, the restore operation fails. Thus, to prevent
+ * it from happening check whether user serviceable snapshots features
+ * is enabled before restoring snapd. If its disbaled, then simply
+ * exit by returning success (without even checking for the snapd.info).
+ */
+
+ if (!dict_get_str_boolean (volinfo->dict, "features.uss", _gf_false)) {
+ ret = 0;
+ goto out;
+ }
+
GLUSTERD_GET_VOLUME_DIR(volpath, volinfo, conf);
snprintf (path, sizeof (path), "%s/%s", volpath,