static void
cib_peer_update_callback(enum crm_status_type type, crm_node_t * node, const void *data)
{
    switch (type) {
        case crm_status_processes:
            if (cib_legacy_mode()
                && is_not_set(node->processes, crm_get_cluster_proc())) {

                uint32_t old = data? *(const uint32_t *)data : 0;

                if ((node->processes ^ old) & crm_proc_cpg) {
                    crm_info("Attempting to disable legacy mode after %s left the cluster",
                             node->uname);
                    legacy_mode = FALSE;
                }
            }
            break;

        case crm_status_uname:
        case crm_status_nstate:
            if (cib_shutdown_flag && (crm_active_peers() < 2)
                && crm_hash_table_size(client_connections) == 0) {

                crm_info("No more peers");
                terminate_cib(__FUNCTION__, -1);
            }
            break;
    }
}
Example #2
0
static uint32_t
get_process_list(void)
{
    int lpc = 0;
    uint32_t procs = crm_get_cluster_proc();

    for (lpc = 0; lpc < SIZEOF(pcmk_children); lpc++) {
        if (pcmk_children[lpc].pid != 0) {
            procs |= pcmk_children[lpc].flag;
        }
    }
    return procs;
}
Example #3
0
void
attrd_peer_change_cb(enum crm_status_type kind, crm_node_t *peer, const void *data)
{
    bool remove_voter = FALSE;

    switch (kind) {
        case crm_status_uname:
            break;

        case crm_status_processes:
            if (is_not_set(peer->processes, crm_get_cluster_proc())) {
                remove_voter = TRUE;
            }
            break;

        case crm_status_nstate:
            if (safe_str_eq(peer->state, CRM_NODE_MEMBER)) {
                /* If we're the writer, send new peers a list of all attributes
                 * (unless it's a remote node, which doesn't run its own attrd)
                 */
                if (attrd_election_won()
                    && !is_set(peer->flags, crm_remote_node)) {
                    attrd_peer_sync(peer, NULL);
                }
            } else {
                // Remove all attribute values associated with lost nodes
                attrd_peer_remove(peer->uname, FALSE, "loss");
                remove_voter = TRUE;
            }
            break;
    }

    // In case an election is in progress, remove any vote by the node
    if (remove_voter) {
        attrd_remove_voter(peer);
    }
}