|
|
7f4c2a |
From fc7a70ad87dbb456685a86b2dcca75b06d02930e Mon Sep 17 00:00:00 2001
|
|
|
7f4c2a |
From: Avra Sengupta <asengupt@redhat.com>
|
|
|
7f4c2a |
Date: Fri, 12 Jun 2015 17:13:05 +0530
|
|
|
7f4c2a |
Subject: [PATCH 097/101] glusterd/uss/snapshot: Intialise snapdsvc after volfiles are created
|
|
|
7f4c2a |
|
|
|
7f4c2a |
snapd svc should be initialised only after all
|
|
|
7f4c2a |
relevant volfiles and directories are created.
|
|
|
7f4c2a |
|
|
|
7f4c2a |
>Reviewed-on: http://review.gluster.org/11227/
|
|
|
7f4c2a |
Change-Id: I96770cfc0b350599cd60ff74f5ecec08145c3105
|
|
|
7f4c2a |
BUG: 1230635
|
|
|
7f4c2a |
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
|
|
|
7f4c2a |
Reviewed-on: https://code.engineering.redhat.com/gerrit/51027
|
|
|
7f4c2a |
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
|
|
|
7f4c2a |
Tested-by: Rajesh Joseph <rjoseph@redhat.com>
|
|
|
7f4c2a |
---
|
|
|
7f4c2a |
xlators/mgmt/glusterd/src/glusterd-snapshot.c | 18 +++++++++---------
|
|
|
7f4c2a |
xlators/mgmt/glusterd/src/glusterd-utils.c | 21 +++++++++++++--------
|
|
|
7f4c2a |
xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 12 +++++++-----
|
|
|
7f4c2a |
3 files changed, 29 insertions(+), 22 deletions(-)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
|
|
|
7f4c2a |
index f779bff..654310c 100644
|
|
|
7f4c2a |
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
|
|
|
7f4c2a |
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
|
|
|
7f4c2a |
@@ -9454,15 +9454,6 @@ gd_restore_snap_volume (dict_t *dict, dict_t *rsp_dict,
|
|
|
7f4c2a |
/* Use the same version as the original version */
|
|
|
7f4c2a |
new_volinfo->version = orig_vol->version;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- /* Initialize the snapd service */
|
|
|
7f4c2a |
- ret = glusterd_snapdsvc_init (new_volinfo);
|
|
|
7f4c2a |
- if (ret) {
|
|
|
7f4c2a |
- gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
- GD_MSG_SNAPD_INIT_FAIL, "Failed to initialize snapd "
|
|
|
7f4c2a |
- "service for volume %s", orig_vol->volname);
|
|
|
7f4c2a |
- goto out;
|
|
|
7f4c2a |
- }
|
|
|
7f4c2a |
-
|
|
|
7f4c2a |
/* Copy the snap vol info to the new_volinfo.*/
|
|
|
7f4c2a |
ret = glusterd_snap_volinfo_restore (dict, rsp_dict, new_volinfo,
|
|
|
7f4c2a |
snap_vol, volcount);
|
|
|
7f4c2a |
@@ -9533,6 +9524,15 @@ gd_restore_snap_volume (dict_t *dict, dict_t *rsp_dict,
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
+ /* Initialize the snapd service */
|
|
|
7f4c2a |
+ ret = glusterd_snapdsvc_init (new_volinfo);
|
|
|
7f4c2a |
+ if (ret) {
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ GD_MSG_SNAPD_INIT_FAIL, "Failed to initialize snapd "
|
|
|
7f4c2a |
+ "service for volume %s", orig_vol->volname);
|
|
|
7f4c2a |
+ goto out;
|
|
|
7f4c2a |
+ }
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
ret = 0;
|
|
|
7f4c2a |
out:
|
|
|
7f4c2a |
if (ret) {
|
|
|
7f4c2a |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
7f4c2a |
index 23a60d2..f374f94 100644
|
|
|
7f4c2a |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
7f4c2a |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
7f4c2a |
@@ -3784,14 +3784,6 @@ glusterd_import_friend_volume (dict_t *peer_data, size_t count)
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- ret = glusterd_snapdsvc_init (new_volinfo);
|
|
|
7f4c2a |
- if (ret) {
|
|
|
7f4c2a |
- gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
- GD_MSG_SNAPD_INIT_FAIL, "Failed to initialize "
|
|
|
7f4c2a |
- "snapdsvc for volume %s", new_volinfo->volname);
|
|
|
7f4c2a |
- goto out;
|
|
|
7f4c2a |
- }
|
|
|
7f4c2a |
-
|
|
|
7f4c2a |
ret = glusterd_volinfo_find (new_volinfo->volname, &old_volinfo);
|
|
|
7f4c2a |
if (0 == ret) {
|
|
|
7f4c2a |
/* snapdsvc initialization of old_volinfo is also required here
|
|
|
7f4c2a |
@@ -3819,6 +3811,19 @@ glusterd_import_friend_volume (dict_t *peer_data, size_t count)
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
ret = glusterd_store_volinfo (new_volinfo, GLUSTERD_VOLINFO_VER_AC_NONE);
|
|
|
7f4c2a |
+ if (ret) {
|
|
|
7f4c2a |
+ gf_log (this->name, GF_LOG_ERROR, "Failed to store "
|
|
|
7f4c2a |
+ "volinfo for volume %s", new_volinfo->volname);
|
|
|
7f4c2a |
+ goto out;
|
|
|
7f4c2a |
+ }
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+ ret = glusterd_snapdsvc_init (new_volinfo);
|
|
|
7f4c2a |
+ if (ret) {
|
|
|
7f4c2a |
+ gf_log (this->name, GF_LOG_ERROR, "Failed to initialize "
|
|
|
7f4c2a |
+ "snapdsvc for volume %s", new_volinfo->volname);
|
|
|
7f4c2a |
+ goto out;
|
|
|
7f4c2a |
+ }
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
ret = glusterd_create_volfiles_and_notify_services (new_volinfo);
|
|
|
7f4c2a |
if (ret)
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
7f4c2a |
index ac66efe..7872314 100644
|
|
|
7f4c2a |
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
7f4c2a |
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
7f4c2a |
@@ -2279,16 +2279,18 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
volinfo->caps = caps;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- ret = glusterd_snapdsvc_init (volinfo);
|
|
|
7f4c2a |
+ ret = glusterd_store_volinfo (volinfo,
|
|
|
7f4c2a |
+ GLUSTERD_VOLINFO_VER_AC_INCREMENT);
|
|
|
7f4c2a |
if (ret) {
|
|
|
7f4c2a |
- *op_errstr = gf_strdup ("Failed to initialize snapd service");
|
|
|
7f4c2a |
+ glusterd_store_delete_volume (volinfo);
|
|
|
7f4c2a |
+ *op_errstr = gf_strdup ("Failed to store the "
|
|
|
7f4c2a |
+ "Volume information");
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- ret = glusterd_store_volinfo (volinfo, GLUSTERD_VOLINFO_VER_AC_INCREMENT);
|
|
|
7f4c2a |
+ ret = glusterd_snapdsvc_init (volinfo);
|
|
|
7f4c2a |
if (ret) {
|
|
|
7f4c2a |
- glusterd_store_delete_volume (volinfo);
|
|
|
7f4c2a |
- *op_errstr = gf_strdup ("Failed to store the Volume information");
|
|
|
7f4c2a |
+ *op_errstr = gf_strdup ("Failed to initialize snapd service");
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
--
|
|
|
7f4c2a |
1.7.1
|
|
|
7f4c2a |
|