summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-server-quorum.h
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kparthas@redhat.com>2015-01-27 15:12:03 +0530
committerKaushal M <kaushal@redhat.com>2015-04-01 06:07:14 -0700
commit4b18fba4064992e00cd5ebe1831afc79beab17b2 (patch)
treeb4e16fb27ba11a04b7262865a8c3de184d457b67 /xlators/mgmt/glusterd/src/glusterd-server-quorum.h
parent2b949eb89e8ca22d2928c05d549b6f722adf1544 (diff)
glusterd: group server-quorum related code together
Server-quorum implementation was spread in many files. This patch brings them all together into a single file, namely glusterd-server-quorum.c. All exported functions are available via glusterd-server-quorum.h Change-Id: I8fd77114b5bc6b05127cb8a6a641e0295f0be7bb BUG: 1205592 Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-on: http://review.gluster.org/9492 Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaushal M <kaushal@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-server-quorum.h')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-server-quorum.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-server-quorum.h b/xlators/mgmt/glusterd/src/glusterd-server-quorum.h
new file mode 100644
index 00000000000..96aba06df24
--- /dev/null
+++ b/xlators/mgmt/glusterd/src/glusterd-server-quorum.h
@@ -0,0 +1,59 @@
+/*
+ Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
+ This file is part of GlusterFS.
+
+ This file is licensed to you under your choice of the GNU Lesser
+ General Public License, version 3 or any later version (LGPLv3 or
+ later), or the GNU General Public License, version 2 (GPLv2), in all
+ cases as published by the Free Software Foundation.
+*/
+#ifndef _GLUSTERD_SERVER_QUORUM_H
+#define _GLUSTERD_SERVER_QUORUM_H
+
+#ifndef _CONFIG_H
+#define _CONFIG_H
+#include "config.h"
+#endif
+
+#define glusterd_quorum_count(peerinfo, inquorum_count,\
+ active_count, _exit)\
+do {\
+ if (peerinfo->quorum_contrib == QUORUM_WAITING)\
+ goto _exit;\
+ if (_is_contributing_to_quorum (peerinfo->quorum_contrib))\
+ inquorum_count = inquorum_count + 1;\
+ if (active_count && (peerinfo->quorum_contrib == QUORUM_UP))\
+ *active_count = *active_count + 1;\
+} while (0)
+
+
+int
+glusterd_validate_quorum (xlator_t *this, glusterd_op_t op, dict_t *dict,
+ char **op_errstr);
+
+gf_boolean_t
+glusterd_is_quorum_changed (dict_t *options, char *option, char *value);
+
+int
+glusterd_do_quorum_action ();
+
+int
+glusterd_get_quorum_cluster_counts (xlator_t *this, int *active_count,
+ int *quorum_count,
+ struct list_head *peer_list,
+ gf_boolean_t _local__xaction_peers);
+
+gf_boolean_t
+glusterd_is_quorum_option (char *option);
+
+gf_boolean_t
+glusterd_is_volume_in_server_quorum (glusterd_volinfo_t *volinfo);
+
+gf_boolean_t
+glusterd_is_any_volume_in_server_quorum (xlator_t *this);
+
+gf_boolean_t
+does_gd_meet_server_quorum (xlator_t *this,
+ struct list_head *peers_list,
+ gf_boolean_t _local__xaction_peers);
+#endif /* _GLUSTERD_SERVER_QUORUM_H */