ipc_votequorum.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /*
  2. * Copyright (c) 2009-2012 Red Hat, Inc.
  3. *
  4. * All rights reserved.
  5. *
  6. * Authors: Christine Caulfield (ccaulfie@redhat.com)
  7. * Fabio M. Di Nitto (fdinitto@redhat.com)
  8. *
  9. * This software licensed under BSD license, the text of which follows:
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above copyright notice,
  15. * this list of conditions and the following disclaimer.
  16. * - Redistributions in binary form must reproduce the above copyright notice,
  17. * this list of conditions and the following disclaimer in the documentation
  18. * and/or other materials provided with the distribution.
  19. * - Neither the name of the MontaVista Software, Inc. nor the names of its
  20. * contributors may be used to endorse or promote products derived from this
  21. * software without specific prior written permission.
  22. *
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTIBUTORS "AS IS"
  24. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  25. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  26. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  27. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  28. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  29. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  30. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  31. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  32. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  33. * THE POSSIBILITY OF SUCH DAMAGE.
  34. */
  35. #ifndef IPC_VOTEQUORUM_H_DEFINED
  36. #define IPC_VOTEQUORUM_H_DEFINED
  37. #include <corosync/mar_gen.h>
  38. #define VOTEQUORUM_QDEVICE_NODEID 0
  39. #define VOTEQUORUM_QDEVICE_MAX_NAME_LEN 255
  40. #define VOTEQUORUM_QDEVICE_DEFAULT_TIMEOUT 10000
  41. enum req_votequorum_types {
  42. MESSAGE_REQ_VOTEQUORUM_GETINFO = 0,
  43. MESSAGE_REQ_VOTEQUORUM_SETEXPECTED,
  44. MESSAGE_REQ_VOTEQUORUM_SETVOTES,
  45. MESSAGE_REQ_VOTEQUORUM_TRACKSTART,
  46. MESSAGE_REQ_VOTEQUORUM_TRACKSTOP,
  47. MESSAGE_REQ_VOTEQUORUM_QDEVICE_REGISTER,
  48. MESSAGE_REQ_VOTEQUORUM_QDEVICE_UNREGISTER,
  49. MESSAGE_REQ_VOTEQUORUM_QDEVICE_UPDATE,
  50. MESSAGE_REQ_VOTEQUORUM_QDEVICE_POLL,
  51. MESSAGE_REQ_VOTEQUORUM_QDEVICE_MASTER_WINS
  52. };
  53. enum res_votequorum_types {
  54. MESSAGE_RES_VOTEQUORUM_STATUS = 0,
  55. MESSAGE_RES_VOTEQUORUM_GETINFO,
  56. MESSAGE_RES_VOTEQUORUM_TRACKSTART,
  57. MESSAGE_RES_VOTEQUORUM_NOTIFICATION,
  58. MESSAGE_RES_VOTEQUORUM_EXPECTEDVOTES_NOTIFICATION
  59. };
  60. struct req_lib_votequorum_qdevice_register {
  61. struct qb_ipc_request_header header __attribute__((aligned(8)));
  62. char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN];
  63. };
  64. struct req_lib_votequorum_qdevice_unregister {
  65. struct qb_ipc_request_header header __attribute__((aligned(8)));
  66. char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN];
  67. };
  68. struct req_lib_votequorum_qdevice_update {
  69. struct qb_ipc_request_header header __attribute__((aligned(8)));
  70. char oldname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN];
  71. char newname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN];
  72. };
  73. struct req_lib_votequorum_qdevice_poll {
  74. struct qb_ipc_request_header header __attribute__((aligned(8)));
  75. char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN];
  76. int cast_vote;
  77. };
  78. struct req_lib_votequorum_qdevice_master_wins {
  79. struct qb_ipc_request_header header __attribute__((aligned(8)));
  80. char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN];
  81. unsigned int allow;
  82. };
  83. struct req_lib_votequorum_setvotes {
  84. struct qb_ipc_request_header header __attribute__((aligned(8)));
  85. unsigned int votes;
  86. int nodeid;
  87. };
  88. struct req_lib_votequorum_setexpected {
  89. struct qb_ipc_request_header header __attribute__((aligned(8)));
  90. unsigned int expected_votes;
  91. };
  92. struct req_lib_votequorum_trackstart {
  93. struct qb_ipc_request_header header __attribute__((aligned(8)));
  94. uint64_t context;
  95. unsigned int track_flags;
  96. };
  97. struct req_lib_votequorum_general {
  98. struct qb_ipc_request_header header __attribute__((aligned(8)));
  99. };
  100. struct req_lib_votequorum_getinfo {
  101. struct qb_ipc_request_header header __attribute__((aligned(8)));
  102. int nodeid;
  103. };
  104. struct res_lib_votequorum_status {
  105. struct qb_ipc_response_header header __attribute__((aligned(8)));
  106. };
  107. #define VOTEQUORUM_INFO_TWONODE 1
  108. #define VOTEQUORUM_INFO_QUORATE 2
  109. #define VOTEQUORUM_INFO_WAIT_FOR_ALL 4
  110. #define VOTEQUORUM_INFO_LAST_MAN_STANDING 8
  111. #define VOTEQUORUM_INFO_AUTO_TIE_BREAKER 16
  112. #define VOTEQUORUM_INFO_ALLOW_DOWNSCALE 32
  113. #define VOTEQUORUM_INFO_QDEVICE_REGISTERED 64
  114. #define VOTEQUORUM_INFO_QDEVICE_ALIVE 128
  115. #define VOTEQUORUM_INFO_QDEVICE_CAST_VOTE 256
  116. #define VOTEQUORUM_INFO_QDEVICE_MASTER_WINS 512
  117. #define VOTEQUORUM_NODESTATE_MEMBER 1
  118. #define VOTEQUORUM_NODESTATE_DEAD 2
  119. #define VOTEQUORUM_NODESTATE_LEAVING 3
  120. struct res_lib_votequorum_getinfo {
  121. struct qb_ipc_response_header header __attribute__((aligned(8)));
  122. unsigned int nodeid;
  123. unsigned int state;
  124. unsigned int votes;
  125. unsigned int expected_votes;
  126. unsigned int highest_expected;
  127. unsigned int total_votes;
  128. unsigned int quorum;
  129. unsigned int flags;
  130. unsigned int qdevice_votes;
  131. char qdevice_name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN];
  132. };
  133. struct votequorum_node {
  134. mar_uint32_t nodeid;
  135. mar_uint32_t state;
  136. };
  137. struct res_lib_votequorum_notification {
  138. struct qb_ipc_response_header header __attribute__((aligned(8)));
  139. mar_uint32_t quorate __attribute__((aligned(8)));
  140. mar_uint64_t context __attribute__((aligned(8)));
  141. mar_uint32_t node_list_entries __attribute__((aligned(8)));
  142. struct votequorum_node node_list[] __attribute__((aligned(8)));
  143. };
  144. struct res_lib_votequorum_expectedvotes_notification {
  145. struct qb_ipc_response_header header __attribute__((aligned(8)));
  146. mar_uint64_t context __attribute__((aligned(8)));
  147. mar_uint32_t expected_votes __attribute__((aligned(8)));
  148. };
  149. #endif