summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-server-quorum.h
blob: 96aba06df24f7a5c885dcf40acce4c3f07662387 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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 */