summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2015-02-11 17:13:45 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2015-02-20 04:04:08 -0800
commit9d842f965655bf70c643b4541844e83bc4e74190 (patch)
tree4d248f27d77993a478267a41e0517228214d7fa0 /xlators/mgmt/glusterd/src/glusterd-volume-ops.c
parent571a71f0acd0ec59340b9d0d2519793e33a1dc16 (diff)
glusterd: nfs,shd,quotad,snapd daemons refactoring
This patch ports nfs, shd, quotad & snapd with the approach suggested in http://www.gluster.org/pipermail/gluster-devel/2014-December/043180.html Change-Id: I4ea5b38793f87fc85cc9d2cf873727351dedffd2 BUG: 1191486 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-on: http://review.gluster.org/9428 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Nekkunti <anekkunt@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volume-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index b90518e1c9a..99c658a7d48 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -29,6 +29,10 @@
#include "glusterd-messages.h"
#include "run.h"
#include "glusterd-snapshot-utils.h"
+#include "glusterd-svc-mgmt.h"
+#include "glusterd-svc-helper.h"
+#include "glusterd-shd-svc.h"
+#include "glusterd-snapd-svc.h"
#include <stdint.h>
#include <sys/socket.h>
@@ -1617,6 +1621,8 @@ glusterd_op_stage_heal_volume (dict_t *dict, char **op_errstr)
xlator_t *this = NULL;
this = THIS;
+ GF_ASSERT (this);
+
priv = this->private;
if (!priv) {
ret = -1;
@@ -1704,7 +1710,7 @@ glusterd_op_stage_heal_volume (dict_t *dict, char **op_errstr)
case GF_AFR_OP_STATISTICS_HEAL_COUNT_PER_REPLICA:
break;
default:
- if (!glusterd_is_nodesvc_online("glustershd")){
+ if (!priv->shd_svc.online) {
ret = -1;
*op_errstr = gf_strdup ("Self-heal daemon is "
"not running. Check self-heal "
@@ -2133,6 +2139,12 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr)
volinfo->caps = caps;
+ ret = glusterd_snapdsvc_init (volinfo);
+ if (ret) {
+ *op_errstr = gf_strdup ("Failed to initialize snapd service");
+ goto out;
+ }
+
ret = glusterd_store_volinfo (volinfo, GLUSTERD_VOLINFO_VER_AC_INCREMENT);
if (ret) {
glusterd_store_delete_volume (volinfo);
@@ -2218,6 +2230,7 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr)
glusterd_brickinfo_t *brickinfo = NULL;
xlator_t *this = NULL;
glusterd_conf_t *conf = NULL;
+ glusterd_svc_t *svc = NULL;
this = THIS;
GF_ASSERT (this);
@@ -2266,11 +2279,14 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr)
if (ret)
goto out;
- ret = glusterd_handle_snapd_option (volinfo);
- if (ret)
- goto out;
+ if (!volinfo->is_snap_volume) {
+ svc = &(volinfo->snapd.svc);
+ ret = svc->manager (svc, volinfo, PROC_START_NO_WAIT);
+ if (ret)
+ goto out;
+ }
- ret = glusterd_nodesvcs_handle_graph_change (volinfo);
+ ret = glusterd_svcs_manager (volinfo);
out:
gf_log (this->name, GF_LOG_TRACE, "returning %d ", ret);
@@ -2285,6 +2301,7 @@ glusterd_stop_volume (glusterd_volinfo_t *volinfo)
char mountdir[PATH_MAX] = {0,};
char pidfile[PATH_MAX] = {0,};
xlator_t *this = NULL;
+ glusterd_svc_t *svc = NULL;
this = THIS;
GF_ASSERT (this);
@@ -2326,11 +2343,14 @@ glusterd_stop_volume (glusterd_volinfo_t *volinfo)
mountdir, strerror (errno));
}
- ret = glusterd_handle_snapd_option (volinfo);
- if (ret)
- goto out;
+ if (!volinfo->is_snap_volume) {
+ svc = &(volinfo->snapd.svc);
+ ret = svc->manager (svc, volinfo, PROC_START_NO_WAIT);
+ if (ret)
+ goto out;
+ }
- ret = glusterd_nodesvcs_handle_graph_change (volinfo);
+ ret = glusterd_svcs_manager (volinfo);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to notify graph "
"change for %s volume", volinfo->volname);