diff --git a/qdevices/corosync-qdevice.c b/qdevices/corosync-qdevice.c index 254b9de2..d7d8934d 100644 --- a/qdevices/corosync-qdevice.c +++ b/qdevices/corosync-qdevice.c @@ -1,250 +1,255 @@ /* * Copyright (c) 2015-2016 Red Hat, Inc. * * All rights reserved. * * Author: Jan Friesse (jfriesse@redhat.com) * * This software licensed under BSD license, the text of which follows: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * - Neither the name of the Red Hat, Inc. nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #include #include #include "dynar.h" #include "dynar-str.h" #include "dynar-getopt-lex.h" #include "qdevice-advanced-settings.h" #include "qdevice-config.h" #include "qdevice-cmap.h" #include "qdevice-ipc.h" #include "qdevice-log.h" #include "qdevice-model.h" #include "qdevice-votequorum.h" #include "utils.h" struct qdevice_instance *global_instance; static void signal_int_handler(int sig) { qdevice_log(LOG_DEBUG, "SIGINT received - closing local unix socket"); qdevice_ipc_close(global_instance); } static void signal_term_handler(int sig) { qdevice_log(LOG_DEBUG, "SIGTERM received - closing server socket"); qdevice_ipc_close(global_instance); } static void signal_handlers_register(void) { struct sigaction act; act.sa_handler = signal_int_handler; sigemptyset(&act.sa_mask); act.sa_flags = SA_RESTART; sigaction(SIGINT, &act, NULL); act.sa_handler = signal_term_handler; sigemptyset(&act.sa_mask); act.sa_flags = SA_RESTART; sigaction(SIGTERM, &act, NULL); } static void usage(void) { printf("usage: %s [-dfh] [-S option=value[,option2=value2,...]]\n", QDEVICE_PROGRAM_NAME); } static void cli_parse_long_opt(struct qdevice_advanced_settings *advanced_settings, const char *long_opt) { struct dynar_getopt_lex lex; struct dynar dynar_long_opt; const char *opt; const char *val; int res; dynar_init(&dynar_long_opt, strlen(long_opt) + 1); if (dynar_str_cpy(&dynar_long_opt, long_opt) != 0) { errx(1, "Can't alloc memory for long option"); } dynar_getopt_lex_init(&lex, &dynar_long_opt); while (dynar_getopt_lex_token_next(&lex) == 0 && strcmp(dynar_data(&lex.option), "") != 0) { opt = dynar_data(&lex.option); val = dynar_data(&lex.value); res = qdevice_advanced_settings_set(advanced_settings, opt, val); switch (res) { case -1: errx(1, "Unknown option '%s'", opt); break; case -2: errx(1, "Invalid value '%s' for option '%s'", val, opt); break; } } dynar_getopt_lex_destroy(&lex); dynar_destroy(&dynar_long_opt); } static void cli_parse(int argc, char * const argv[], int *foreground, int *force_debug, struct qdevice_advanced_settings *advanced_settings) { int ch; *foreground = 0; *force_debug = 0; while ((ch = getopt(argc, argv, "dfhS:")) != -1) { switch (ch) { case 'd': *force_debug = 1; break; case 'f': *foreground = 1; break; case 'S': cli_parse_long_opt(advanced_settings, optarg); break; case 'h': case '?': usage(); exit(1); break; } } } int main(int argc, char * const argv[]) { struct qdevice_instance instance; struct qdevice_advanced_settings advanced_settings; int foreground; int force_debug; int lock_file; int another_instance_running; if (qdevice_advanced_settings_init(&advanced_settings) != 0) { errx(1, "Can't alloc memory for advanced settings"); } cli_parse(argc, argv, &foreground, &force_debug, &advanced_settings); qdevice_instance_init(&instance, &advanced_settings); qdevice_cmap_init(&instance); qdevice_log_init(&instance, force_debug); /* * Daemonize */ if (!foreground) { utils_tty_detach(); } if ((lock_file = utils_flock(advanced_settings.lock_file, getpid(), &another_instance_running)) == -1) { if (another_instance_running) { qdevice_log(LOG_ERR, "Another instance is running"); } else { qdevice_log_err(LOG_ERR, "Can't aquire lock"); } exit(1); } qdevice_log(LOG_DEBUG, "Initializing votequorum"); qdevice_votequorum_init(&instance); qdevice_log(LOG_DEBUG, "Initializing local socket"); if (qdevice_ipc_init(&instance) != 0) { return (1); } qdevice_log(LOG_DEBUG, "Registering qdevice models"); qdevice_model_register_all(); qdevice_log(LOG_DEBUG, "Configuring qdevice"); if (qdevice_instance_configure_from_cmap(&instance) != 0) { return (1); } qdevice_log(LOG_DEBUG, "Getting configuration node list"); if (qdevice_cmap_store_config_node_list(&instance) != 0) { return (1); } qdevice_log(LOG_DEBUG, "Initializing qdevice model"); if (qdevice_model_init(&instance) != 0) { return (1); } qdevice_log(LOG_DEBUG, "Initializing cmap tracking"); if (qdevice_cmap_add_track(&instance) != 0) { return (1); } + qdevice_log(LOG_DEBUG, "Waiting for ring id"); + if (qdevice_votequorum_wait_for_ring_id(&instance) != 0) { + return (1); + } + global_instance = &instance; signal_handlers_register(); qdevice_log(LOG_DEBUG, "Running qdevice model"); if (qdevice_model_run(&instance) != 0) { return (1); } qdevice_log(LOG_DEBUG, "Removing cmap tracking"); if (qdevice_cmap_del_track(&instance) != 0) { return (1); } qdevice_log(LOG_DEBUG, "Destorying qdevice model"); qdevice_model_destroy(&instance); qdevice_ipc_destroy(&instance); qdevice_votequorum_destroy(&instance); qdevice_cmap_destroy(&instance); qdevice_log_close(&instance); qdevice_instance_destroy(&instance); qdevice_advanced_settings_destroy(&advanced_settings); return (0); } diff --git a/qdevices/qdevice-instance.h b/qdevices/qdevice-instance.h index b93c7f54..c7996c46 100644 --- a/qdevices/qdevice-instance.h +++ b/qdevices/qdevice-instance.h @@ -1,121 +1,122 @@ /* * Copyright (c) 2015-2016 Red Hat, Inc. * * All rights reserved. * * Author: Jan Friesse (jfriesse@redhat.com) * * This software licensed under BSD license, the text of which follows: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * - Neither the name of the Red Hat, Inc. nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _QDEVICE_INSTANCE_H_ #define _QDEVICE_INSTANCE_H_ #include #include #include #include #include #include "qdevice-advanced-settings.h" #include "qdevice-model-type.h" #include "node-list.h" #include "unix-socket-ipc.h" #ifdef __cplusplus extern "C" { #endif struct qdevice_instance { cmap_handle_t cmap_handle; int cmap_poll_fd; int cmap_reload_in_progress; cmap_track_handle_t cmap_reload_track_handle; cmap_track_handle_t cmap_nodelist_track_handle; cmap_track_handle_t cmap_logging_track_handle; votequorum_handle_t votequorum_handle; int votequorum_poll_fd; struct unix_socket_ipc local_ipc; enum qdevice_model_type model_type; uint32_t node_id; uint32_t heartbeat_interval; /* Heartbeat interval during normal operation */ uint32_t sync_heartbeat_interval; /* Heartbeat interval during corosync sync */ struct node_list config_node_list; int config_node_list_version_set; uint64_t config_node_list_version; /* * Copy of votequorum_quorum_notify_fn callback paramters. * Set after model callback is called. */ uint32_t vq_quorum_quorate; uint32_t vq_quorum_node_list_entries; votequorum_node_t *vq_quorum_node_list; /* * Copy of votequorum_nodelist_notify_fn callback paramters. * Set after model callback is called. */ + uint8_t vq_node_list_ring_id_set; votequorum_ring_id_t vq_node_list_ring_id; uint32_t vq_node_list_entries; uint32_t *vq_node_list; /* * Copy of votequorum_expectedvotes_notify_fn callback parameters. * Set after model callback is called. */ uint32_t vq_expected_votes; time_t vq_last_poll; int vq_last_poll_cast_vote; void *model_data; const struct qdevice_advanced_settings *advanced_settings; int sync_in_progress; }; extern int qdevice_instance_init(struct qdevice_instance *instance, const struct qdevice_advanced_settings *advanced_settings); extern int qdevice_instance_destroy(struct qdevice_instance *instance); extern int qdevice_instance_configure_from_cmap(struct qdevice_instance *instance); #ifdef __cplusplus } #endif #endif /* _QDEVICE_INSTANCE_H_ */ diff --git a/qdevices/qdevice-votequorum.c b/qdevices/qdevice-votequorum.c index 946854c4..562a731c 100644 --- a/qdevices/qdevice-votequorum.c +++ b/qdevices/qdevice-votequorum.c @@ -1,279 +1,301 @@ /* * Copyright (c) 2015-2016 Red Hat, Inc. * * All rights reserved. * * Author: Jan Friesse (jfriesse@redhat.com) * * This software licensed under BSD license, the text of which follows: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * - Neither the name of the Red Hat, Inc. nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #include #include "qdevice-config.h" #include "qdevice-log.h" #include "qdevice-votequorum.h" #include "qdevice-model.h" #include "utils.h" static void qdevice_votequorum_quorum_notify_callback(votequorum_handle_t votequorum_handle, uint64_t context, uint32_t quorate, uint32_t node_list_entries, votequorum_node_t node_list[]) { struct qdevice_instance *instance; uint32_t u32; if (votequorum_context_get(votequorum_handle, (void **)&instance) != CS_OK) { qdevice_log(LOG_CRIT, "Fatal error. Can't get votequorum context"); exit(1); } instance->sync_in_progress = 0; qdevice_log(LOG_DEBUG, "Votequorum quorum notify callback:"); qdevice_log(LOG_DEBUG, " Quorate = %u", quorate); qdevice_log(LOG_DEBUG, " Node list (size = %"PRIu32"):", node_list_entries); for (u32 = 0; u32 < node_list_entries; u32++) { qdevice_log(LOG_DEBUG, " %"PRIu32" nodeid = "UTILS_PRI_NODE_ID", state = %"PRIu32, u32, node_list[u32].nodeid, node_list[u32].state); } if (qdevice_model_votequorum_quorum_notify(instance, quorate, node_list_entries, node_list) != 0) { qdevice_log(LOG_DEBUG, "qdevice_model_votequorum_quorum_notify returned error -> exit"); exit(2); } instance->vq_quorum_quorate = quorate; instance->vq_quorum_node_list_entries = node_list_entries; free(instance->vq_quorum_node_list); instance->vq_quorum_node_list = malloc(sizeof(*node_list) * node_list_entries); if (instance->vq_quorum_node_list == NULL) { qdevice_log(LOG_CRIT, "Can't alloc votequorum node list memory"); exit(1); } memcpy(instance->vq_quorum_node_list, node_list, sizeof(*node_list) * node_list_entries); } static void qdevice_votequorum_node_list_notify_callback(votequorum_handle_t votequorum_handle, uint64_t context, votequorum_ring_id_t votequorum_ring_id, uint32_t node_list_entries, uint32_t node_list[]) { struct qdevice_instance *instance; uint32_t u32; if (votequorum_context_get(votequorum_handle, (void **)&instance) != CS_OK) { qdevice_log(LOG_CRIT, "Fatal error. Can't get votequorum context"); exit(1); } instance->sync_in_progress = 1; qdevice_log(LOG_DEBUG, "Votequorum nodelist notify callback:"); qdevice_log(LOG_DEBUG, " Ring_id = ("UTILS_PRI_RING_ID")", votequorum_ring_id.nodeid, votequorum_ring_id.seq); qdevice_log(LOG_DEBUG, " Node list (size = %"PRIu32"):", node_list_entries); for (u32 = 0; u32 < node_list_entries; u32++) { qdevice_log(LOG_DEBUG, " %"PRIu32" nodeid = "UTILS_PRI_NODE_ID, u32, node_list[u32]); } if (qdevice_model_votequorum_node_list_notify(instance, votequorum_ring_id, node_list_entries, node_list) != 0) { qdevice_log(LOG_DEBUG, "qdevice_votequorum_node_list_notify_callback returned error -> exit"); exit(2); } + instance->vq_node_list_ring_id_set = 1; memcpy(&instance->vq_node_list_ring_id, &votequorum_ring_id, sizeof(votequorum_ring_id)); instance->vq_node_list_entries = node_list_entries; free(instance->vq_node_list); instance->vq_node_list = malloc(sizeof(*node_list) * node_list_entries); if (instance->vq_node_list == NULL) { qdevice_log(LOG_CRIT, "Can't alloc votequorum node list memory"); exit(1); } memcpy(instance->vq_node_list, node_list, sizeof(*node_list) * node_list_entries); } static void qdevice_votequorum_expected_votes_notify_callback(votequorum_handle_t votequorum_handle, uint64_t context, uint32_t expected_votes) { struct qdevice_instance *instance; if (votequorum_context_get(votequorum_handle, (void **)&instance) != CS_OK) { qdevice_log(LOG_CRIT, "Fatal error. Can't get votequorum context"); exit(1); } qdevice_log(LOG_DEBUG, "Votequorum expected_votes notify callback:"); qdevice_log(LOG_DEBUG, " Expected_votes: "UTILS_PRI_EXPECTED_VOTES, expected_votes); if (qdevice_model_votequorum_expected_votes_notify(instance, expected_votes) != 0) { qdevice_log(LOG_DEBUG, "qdevice_votequorum_expected_votes_notify_callback returned error -> exit"); exit(2); } instance->vq_expected_votes = expected_votes; } void qdevice_votequorum_init(struct qdevice_instance *instance) { votequorum_callbacks_t votequorum_callbacks; votequorum_handle_t votequorum_handle; cs_error_t res; int no_retries; struct votequorum_info vq_info; memset(&votequorum_callbacks, 0, sizeof(votequorum_callbacks)); votequorum_callbacks.votequorum_quorum_notify_fn = qdevice_votequorum_quorum_notify_callback; votequorum_callbacks.votequorum_nodelist_notify_fn = qdevice_votequorum_node_list_notify_callback; votequorum_callbacks.votequorum_expectedvotes_notify_fn = qdevice_votequorum_expected_votes_notify_callback; no_retries = 0; while ((res = votequorum_initialize(&votequorum_handle, &votequorum_callbacks)) == CS_ERR_TRY_AGAIN && no_retries++ < instance->advanced_settings->max_cs_try_again) { (void)poll(NULL, 0, 1000); } if (res != CS_OK) { qdevice_log(LOG_CRIT, "Failed to initialize the votequorum API. Error %s", cs_strerror(res)); exit(1); } if ((res = votequorum_qdevice_register(votequorum_handle, instance->advanced_settings->votequorum_device_name)) != CS_OK) { qdevice_log(LOG_CRIT, "Can't register votequorum device. Error %s", cs_strerror(res)); exit(1); } if ((res = votequorum_context_set(votequorum_handle, (void *)instance)) != CS_OK) { qdevice_log(LOG_CRIT, "Can't set votequorum context. Error %s", cs_strerror(res)); exit(1); } if ((res = votequorum_getinfo(votequorum_handle, VOTEQUORUM_QDEVICE_NODEID, &vq_info)) != CS_OK) { qdevice_log(LOG_CRIT, "Can't get votequorum information. Error %s", cs_strerror(res)); exit(1); } instance->vq_expected_votes = vq_info.node_expected_votes; instance->votequorum_handle = votequorum_handle; votequorum_fd_get(votequorum_handle, &instance->votequorum_poll_fd); if ((res = votequorum_trackstart(instance->votequorum_handle, 0, CS_TRACK_CHANGES)) != CS_OK) { qdevice_log(LOG_CRIT, "Can't start tracking votequorum changes. Error %s", cs_strerror(res)); exit(1); } } void qdevice_votequorum_destroy(struct qdevice_instance *instance) { cs_error_t res; free(instance->vq_quorum_node_list); instance->vq_quorum_node_list = NULL; free(instance->vq_node_list); instance->vq_node_list = NULL; res = votequorum_trackstop(instance->votequorum_handle); if (res != CS_OK) { qdevice_log(LOG_WARNING, "Can't start tracking votequorum changes. Error %s", cs_strerror(res)); } res = votequorum_qdevice_unregister(instance->votequorum_handle, instance->advanced_settings->votequorum_device_name); if (res != CS_OK) { qdevice_log(LOG_WARNING, "Unable to unregister votequorum device. Error %s", cs_strerror(res)); } res = votequorum_finalize(instance->votequorum_handle); if (res != CS_OK) { qdevice_log(LOG_WARNING, "Unable to finalize votequorum. Error %s", cs_strerror(res)); } } +int +qdevice_votequorum_wait_for_ring_id(struct qdevice_instance *instance) +{ + int no_retries; + + no_retries = 0; + + while (!instance->vq_node_list_ring_id_set && + qdevice_votequorum_dispatch(instance) != -1 && + no_retries++ < instance->advanced_settings->max_cs_try_again) { + (void)poll(NULL, 0, 1000); + } + + if (!instance->vq_node_list_ring_id_set) { + qdevice_log(LOG_CRIT, "Can't get initial votequorum membership information."); + return (-1); + } + + return (0); +} + int qdevice_votequorum_dispatch(struct qdevice_instance *instance) { cs_error_t res; res = votequorum_dispatch(instance->votequorum_handle, CS_DISPATCH_ALL); if (res != CS_OK && res != CS_ERR_TRY_AGAIN) { qdevice_log(LOG_ERR, "Can't dispatch votequorum messages"); return (-1); } return (0); } int qdevice_votequorum_poll(struct qdevice_instance *instance, int cast_vote) { cs_error_t res; instance->vq_last_poll = time(NULL); instance->vq_last_poll_cast_vote = cast_vote; res = votequorum_qdevice_poll(instance->votequorum_handle, instance->advanced_settings->votequorum_device_name, cast_vote, instance->vq_node_list_ring_id); if (res != CS_OK && res != CS_ERR_TRY_AGAIN) { if (res == CS_ERR_MESSAGE_ERROR) { qdevice_log(LOG_INFO, "qdevice_votequorum_poll called with old ring id"); } else { qdevice_log(LOG_CRIT, "Can't call votequorum_qdevice_poll. Error %s", cs_strerror(res)); return (-1); } } return (0); } diff --git a/qdevices/qdevice-votequorum.h b/qdevices/qdevice-votequorum.h index 23f3d82e..c444315b 100644 --- a/qdevices/qdevice-votequorum.h +++ b/qdevices/qdevice-votequorum.h @@ -1,59 +1,62 @@ /* * Copyright (c) 2015-2016 Red Hat, Inc. * * All rights reserved. * * Author: Jan Friesse (jfriesse@redhat.com) * * This software licensed under BSD license, the text of which follows: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * - Neither the name of the Red Hat, Inc. nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _QDEVICE_VOTEQUORUM_H_ #define _QDEVICE_VOTEQUORUM_H_ #include #include "qdevice-instance.h" #ifdef __cplusplus extern "C" { #endif extern void qdevice_votequorum_init(struct qdevice_instance *instance); extern void qdevice_votequorum_destroy(struct qdevice_instance *instance); extern int qdevice_votequorum_dispatch(struct qdevice_instance *instance); extern int qdevice_votequorum_poll(struct qdevice_instance *instance, int cast_vote); +extern int qdevice_votequorum_wait_for_ring_id( + struct qdevice_instance *instance); + #ifdef __cplusplus } #endif #endif /* _QDEVICE_VOTEQUORUM_H_ */