Skip to content

Commit 2477889

Browse files
committed
Feature: controller: record the timestamps of a node becoming a cluster member and online in CPG in CIB node_state
... with `in_ccm` and `crmd` fields. - A value 0 of `in_ccm` means the node is not a cluster member. - A value 0 of `crmd` means the peer is offline in CPG. But still record in the old way for rolling upgrades when the DC hasn't been updated yet.
1 parent aa25e67 commit 2477889

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

daemons/controld/controld_membership.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,17 +149,31 @@ create_node_state_update(crm_node_t *node, int flags, xmlNode *parent,
149149
crm_xml_add(node_state, XML_ATTR_UNAME, node->uname);
150150

151151
if ((flags & node_update_cluster) && node->state) {
152-
pcmk__xe_set_bool_attr(node_state, XML_NODE_IN_CLUSTER,
153-
pcmk__str_eq(node->state, CRM_NODE_MEMBER, pcmk__str_casei));
152+
if (compare_version(controld_globals.dc_version, "3.18.0") >= 0) {
153+
// A value 0 means the node is not a cluster member.
154+
crm_xml_add_ll(node_state, XML_NODE_IN_CLUSTER, node->when_member);
155+
156+
} else {
157+
pcmk__xe_set_bool_attr(node_state, XML_NODE_IN_CLUSTER,
158+
pcmk__str_eq(node->state, CRM_NODE_MEMBER,
159+
pcmk__str_casei));
160+
}
154161
}
155162

156163
if (!pcmk_is_set(node->flags, crm_remote_node)) {
157164
if (flags & node_update_peer) {
158-
value = OFFLINESTATUS;
159-
if (pcmk_is_set(node->processes, crm_get_cluster_proc())) {
160-
value = ONLINESTATUS;
165+
if (compare_version(controld_globals.dc_version, "3.18.0") >= 0) {
166+
// A value 0 means the peer is offline in CPG.
167+
crm_xml_add_ll(node_state, XML_NODE_IS_PEER,
168+
node->when_online);
169+
170+
} else {
171+
value = OFFLINESTATUS;
172+
if (pcmk_is_set(node->processes, crm_get_cluster_proc())) {
173+
value = ONLINESTATUS;
174+
}
175+
crm_xml_add(node_state, XML_NODE_IS_PEER, value);
161176
}
162-
crm_xml_add(node_state, XML_NODE_IS_PEER, value);
163177
}
164178

165179
if (flags & node_update_join) {

0 commit comments

Comments
 (0)