]>
Commit | Line | Data |
---|---|---|
9a1955a7 | 1 | /* |
bb9dabf9 | 2 | * Copyright (c) 2015-2019 Red Hat, Inc. |
9a1955a7 JF |
3 | * |
4 | * All rights reserved. | |
5 | * | |
6 | * Author: Jan Friesse (jfriesse@redhat.com) | |
7 | * | |
8 | * This software licensed under BSD license, the text of which follows: | |
9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions are met: | |
12 | * | |
13 | * - Redistributions of source code must retain the above copyright notice, | |
14 | * this list of conditions and the following disclaimer. | |
15 | * - Redistributions in binary form must reproduce the above copyright notice, | |
16 | * this list of conditions and the following disclaimer in the documentation | |
17 | * and/or other materials provided with the distribution. | |
18 | * - Neither the name of the Red Hat, Inc. nor the names of its | |
19 | * contributors may be used to endorse or promote products derived from this | |
20 | * software without specific prior written permission. | |
21 | * | |
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | |
26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
32 | * THE POSSIBILITY OF SUCH DAMAGE. | |
33 | */ | |
34 | ||
bb9dabf9 | 35 | #include "log.h" |
c099509e | 36 | #include "log-common.h" |
9a1955a7 JF |
37 | #include "qnetd-log-debug.h" |
38 | #include "utils.h" | |
39 | ||
40 | void | |
41 | qnetd_log_debug_dump_cluster(struct qnetd_cluster *cluster) | |
42 | { | |
43 | struct qnetd_client *client; | |
44 | ||
bb9dabf9 | 45 | log(LOG_DEBUG, " cluster dump:"); |
9a1955a7 | 46 | TAILQ_FOREACH(client, &cluster->client_list, cluster_entries) { |
bb9dabf9 | 47 | log(LOG_DEBUG, " client = %s, node_id = "UTILS_PRI_NODE_ID, |
9a1955a7 JF |
48 | client->addr_str, client->node_id); |
49 | } | |
50 | } | |
51 | ||
52 | void | |
53 | qnetd_log_debug_new_client_connected(struct qnetd_client *client) | |
54 | { | |
55 | ||
bb9dabf9 JF |
56 | log(LOG_DEBUG, "New client connected"); |
57 | log(LOG_DEBUG, " cluster name = %s", client->cluster_name); | |
58 | log(LOG_DEBUG, " tls started = %u", client->tls_started); | |
59 | log(LOG_DEBUG, " tls peer certificate verified = %u", | |
9a1955a7 | 60 | client->tls_peer_certificate_verified); |
bb9dabf9 JF |
61 | log(LOG_DEBUG, " node_id = "UTILS_PRI_NODE_ID, client->node_id); |
62 | log(LOG_DEBUG, " pointer = %p", client); | |
63 | log(LOG_DEBUG, " addr_str = %s", client->addr_str); | |
64 | log(LOG_DEBUG, " ring id = (" UTILS_PRI_RING_ID ")", client->last_ring_id.node_id, | |
9a1955a7 JF |
65 | client->last_ring_id.seq); |
66 | ||
67 | qnetd_log_debug_dump_cluster(client->cluster); | |
68 | } | |
69 | ||
9a1955a7 JF |
70 | void |
71 | qnetd_log_debug_config_node_list_received(struct qnetd_client *client, | |
72 | uint32_t msg_seq_num, int config_version_set, uint64_t config_version, | |
73 | const struct node_list *nodes, int initial) | |
74 | { | |
75 | ||
bb9dabf9 | 76 | log(LOG_DEBUG, "Client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") " |
9a1955a7 JF |
77 | "sent %s node list.", client->addr_str, client->cluster_name, client->node_id, |
78 | (initial ? "initial" : "changed")); | |
79 | ||
bb9dabf9 | 80 | log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); |
9a1955a7 JF |
81 | |
82 | if (config_version_set) { | |
bb9dabf9 | 83 | log(LOG_DEBUG, " config version = " UTILS_PRI_CONFIG_VERSION, config_version); |
9a1955a7 JF |
84 | } |
85 | ||
c099509e | 86 | log_common_debug_dump_node_list(nodes); |
9a1955a7 JF |
87 | } |
88 | ||
89 | void | |
90 | qnetd_log_debug_membership_node_list_received(struct qnetd_client *client, | |
91 | uint32_t msg_seq_num, const struct tlv_ring_id *ring_id, | |
92 | enum tlv_heuristics heuristics, const struct node_list *nodes) | |
93 | { | |
bb9dabf9 | 94 | log(LOG_DEBUG, "Client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") " |
9a1955a7 JF |
95 | "sent membership node list.", client->addr_str, client->cluster_name, client->node_id); |
96 | ||
bb9dabf9 | 97 | log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); |
9a1955a7 | 98 | |
bb9dabf9 | 99 | log(LOG_DEBUG, " ring id = (" UTILS_PRI_RING_ID ")", ring_id->node_id, ring_id->seq); |
9a1955a7 | 100 | |
bb9dabf9 | 101 | log(LOG_DEBUG, " heuristics = %s ", tlv_heuristics_to_str(heuristics)); |
9a1955a7 | 102 | |
c099509e | 103 | log_common_debug_dump_node_list(nodes); |
9a1955a7 JF |
104 | } |
105 | ||
106 | void | |
107 | qnetd_log_debug_quorum_node_list_received(struct qnetd_client *client, | |
108 | uint32_t msg_seq_num, enum tlv_quorate quorate, const struct node_list *nodes) | |
109 | { | |
110 | ||
bb9dabf9 | 111 | log(LOG_DEBUG, "Client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") " |
9a1955a7 JF |
112 | "sent quorum node list.", client->addr_str, client->cluster_name, client->node_id); |
113 | ||
bb9dabf9 JF |
114 | log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); |
115 | log(LOG_DEBUG, " quorate = %u", quorate); | |
9a1955a7 | 116 | |
c099509e | 117 | log_common_debug_dump_node_list(nodes); |
9a1955a7 JF |
118 | } |
119 | ||
120 | void | |
121 | qnetd_log_debug_client_disconnect(struct qnetd_client *client, int server_going_down) | |
122 | { | |
123 | ||
bb9dabf9 | 124 | log(LOG_DEBUG, "Client %s (init_received %u, cluster %s, node_id " |
9a1955a7 JF |
125 | UTILS_PRI_NODE_ID") disconnect%s", client->addr_str, client->init_received, |
126 | client->cluster_name, client->node_id, | |
127 | (server_going_down ? " (server is going down)" : "")); | |
128 | } | |
129 | ||
130 | void | |
131 | qnetd_log_debug_ask_for_vote_received(struct qnetd_client *client, uint32_t msg_seq_num) | |
132 | { | |
133 | ||
bb9dabf9 | 134 | log(LOG_DEBUG, "Client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") " |
9a1955a7 | 135 | "asked for a vote", client->addr_str, client->cluster_name, client->node_id); |
bb9dabf9 | 136 | log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); |
9a1955a7 JF |
137 | } |
138 | ||
139 | void | |
140 | qnetd_log_debug_vote_info_reply_received(struct qnetd_client *client, uint32_t msg_seq_num) | |
141 | { | |
142 | ||
bb9dabf9 | 143 | log(LOG_DEBUG, "Client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") " |
9a1955a7 JF |
144 | "replied back to vote info message", client->addr_str, client->cluster_name, |
145 | client->node_id); | |
bb9dabf9 | 146 | log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); |
9a1955a7 JF |
147 | } |
148 | ||
149 | void | |
150 | qnetd_log_debug_send_vote_info(struct qnetd_client *client, uint32_t msg_seq_num, enum tlv_vote vote) | |
151 | { | |
152 | ||
bb9dabf9 | 153 | log(LOG_DEBUG, "Sending vote info to client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") ", |
9a1955a7 | 154 | client->addr_str, client->cluster_name, client->node_id); |
bb9dabf9 JF |
155 | log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); |
156 | log(LOG_DEBUG, " vote = %s", tlv_vote_to_str(vote)); | |
9a1955a7 JF |
157 | } |
158 | ||
159 | void | |
160 | qnetd_log_debug_heuristics_change_received(struct qnetd_client *client, uint32_t msg_seq_num, | |
161 | enum tlv_heuristics heuristics) | |
162 | { | |
163 | ||
bb9dabf9 | 164 | log(LOG_DEBUG, "Client %s (cluster %s, node_id "UTILS_PRI_NODE_ID") " |
9a1955a7 | 165 | "sent heuristics change", client->addr_str, client->cluster_name, client->node_id); |
bb9dabf9 JF |
166 | log(LOG_DEBUG, " msg seq num = "UTILS_PRI_MSG_SEQ, msg_seq_num); |
167 | log(LOG_DEBUG, " heuristics = %s", tlv_heuristics_to_str(heuristics)); | |
9a1955a7 | 168 | } |