summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-store.h
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kp@gluster.com>2012-03-26 16:11:29 +0530
committerVijay Bellur <vijay@gluster.com>2012-03-31 05:15:08 -0700
commit66d430da4e3788aeb41eea46455ca25a2d19a626 (patch)
treeb52c1189401cc47c7cfecc7e5225938b926b6a4d /xlators/mgmt/glusterd/src/glusterd-store.h
parent3f81c44a03e9ab78be2b4a69e3e36d41a4de324a (diff)
glusterd: Added init scripts like interface for gluster commands
Directories to hold the scripts mentioned above would be created for each gluster command under glusterd's 'working dir' as follows: (eg.) <glusterd-working-dir>/hooks/version/create/pre <glusterd-working-dir>/hooks/version/create/post where, version corresponds to the version of hook scripts. The scripts beginning with 'S' under the above directories would be run before (pre) and after (post) the volume created. The scripts would receive a command line argument as below: --volname=<volname> This can be optionally used by the script. Change-Id: Ia81b4ff9dd4477d99dd59b39c805aa645521edb0 BUG: 806996 Signed-off-by: Krishnan Parthasarathi <kp@gluster.com> Reviewed-on: http://review.gluster.com/3010 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Csaba Henk <csaba@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-store.h')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.h b/xlators/mgmt/glusterd/src/glusterd-store.h
index b381e5a0cce..788949d55fc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.h
+++ b/xlators/mgmt/glusterd/src/glusterd-store.h
@@ -30,6 +30,7 @@
#include "glusterfs.h"
#include "xlator.h"
+#include "run.h"
#include "logging.h"
#include "call-stub.h"
#include "fd.h"
@@ -73,6 +74,10 @@ typedef enum glusterd_store_ver_ac_{
#define GLUSTERD_STORE_KEY_PEER_HOSTNAME "hostname"
#define GLUSTERD_STORE_KEY_PEER_STATE "state"
+#define GLUSTERD_GET_HOOKS_DIR(path, version, priv) \
+ snprintf (path, PATH_MAX, "%s/hooks/%d", priv->workdir,\
+ version);
+
#define glusterd_for_each_entry(entry, dir) \
do {\
entry = NULL;\
@@ -85,6 +90,7 @@ typedef enum glusterd_store_ver_ac_{
}\
} while (0); \
+
typedef enum {
GD_STORE_SUCCESS,
GD_STORE_KEY_NULL,
@@ -95,6 +101,14 @@ typedef enum {
GD_STORE_STAT_FAILED
} glusterd_store_op_errno_t;
+#define GLUSTERD_HOOK_VER 1
+typedef enum glusterd_commit_hook_type {
+ GD_COMMIT_HOOK_NONE = 0,
+ GD_COMMIT_HOOK_PRE,
+ GD_COMMIT_HOOK_POST,
+ GD_COMMIT_HOOK_MAX
+} glusterd_commit_hook_type_t;
+
int32_t
glusterd_store_volinfo (glusterd_volinfo_t *volinfo, glusterd_volinfo_ver_ac_t ac);
@@ -138,4 +152,13 @@ glusterd_perform_volinfo_version_action (glusterd_volinfo_t *volinfo,
glusterd_volinfo_ver_ac_t ac);
gf_boolean_t
glusterd_store_is_valid_brickpath (char *volname, char *brick);
+
+int
+glusterd_store_create_hooks_directory (char *basedir);
+
+char *
+glusterd_store_get_hooks_cmd_subdir (glusterd_op_t op);
+
+int
+glusterd_store_run_hooks (char *hooks_path, dict_t *op_ctx);
#endif