您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CRM_LOG_ASSERT函数代码示例

51自学网 2021-06-01 20:05:31
  C++
这篇教程C++ CRM_LOG_ASSERT函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CRM_LOG_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ CRM_LOG_ASSERT函数的具体用法?C++ CRM_LOG_ASSERT怎么用?C++ CRM_LOG_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CRM_LOG_ASSERT函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: cib_cleanup_none

static enum cib_errorscib_cleanup_none(int options, xmlNode ** data, xmlNode ** output){    CRM_LOG_ASSERT(*data == NULL);    CRM_LOG_ASSERT(*output == NULL);    return cib_ok;}
开发者ID:brhellman,项目名称:pacemaker,代码行数:7,


示例2: stonith_client_disconnect

static gbooleanstonith_client_disconnect(    IPC_Channel *channel, stonith_client_t *stonith_client){    if (channel == NULL) {	CRM_LOG_ASSERT(stonith_client == NULL);		    } else if (stonith_client == NULL) {	crm_err("No client");		    } else {	CRM_LOG_ASSERT(channel->ch_status != IPC_CONNECT);	crm_trace("Cleaning up after client disconnect: %s/%s/%s",		    crm_str(stonith_client->name),		    stonith_client->channel_name,		    stonith_client->id);			if(stonith_client->id != NULL) {	    if(!g_hash_table_remove(client_list, stonith_client->id)) {		crm_err("Client %s not found in the hashtable",			stonith_client->name);	    }	}		    }	    return FALSE;}
开发者ID:tserong,项目名称:pacemaker,代码行数:27,


示例3: cib_cleanup_none

static intcib_cleanup_none(int options, xmlNode ** data, xmlNode ** output){    CRM_LOG_ASSERT(*data == NULL);    CRM_LOG_ASSERT(*output == NULL);    return pcmk_ok;}
开发者ID:JamesGuthrie,项目名称:pacemaker,代码行数:7,


示例4: cib_cleanup_sync

static intcib_cleanup_sync(int options, xmlNode ** data, xmlNode ** output){    /* data is non-NULL but doesnt need to be free'd */    CRM_LOG_ASSERT(*data == NULL);    CRM_LOG_ASSERT(*output == NULL);    return pcmk_ok;}
开发者ID:JamesGuthrie,项目名称:pacemaker,代码行数:8,


示例5: finalize_sync_callback

voidfinalize_sync_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void *user_data){    CRM_LOG_ASSERT(-EPERM != rc);    clear_bit(fsa_input_register, R_CIB_ASKED);    if (rc != pcmk_ok) {        do_crm_log((rc == -pcmk_err_old_data ? LOG_WARNING : LOG_ERR),                   "Sync from %s failed: %s", (char *)user_data, pcmk_strerror(rc));        /* restart the whole join process */        register_fsa_error_adv(C_FSA_INTERNAL, I_ELECTION_DC, NULL, NULL, __FUNCTION__);    } else if (AM_I_DC && fsa_state == S_FINALIZE_JOIN) {        set_bit(fsa_input_register, R_HAVE_CIB);        clear_bit(fsa_input_register, R_CIB_ASKED);        /* make sure dc_uuid is re-set to us */        if (check_join_state(fsa_state, __FUNCTION__) == FALSE) {            crm_debug("Notifying %d clients of join-%d results",                      crmd_join_phase_count(crm_join_integrated), current_join_id);            g_hash_table_foreach(crm_peer_cache, finalize_join_for, NULL);        }    } else {        crm_debug("No longer the DC in S_FINALIZE_JOIN: %s/%s",                  AM_I_DC ? "DC" : "CRMd", fsa_state2string(fsa_state));    }}
开发者ID:oalbrigt,项目名称:pacemaker,代码行数:28,


示例6: set_format_string

static voidset_format_string(int method, const char *daemon){    int offset = 0;    char fmt[FMT_MAX];    if (method > QB_LOG_STDERR) {        /* When logging to a file */        struct utsname res;        if (uname(&res) == 0) {            offset +=                snprintf(fmt + offset, FMT_MAX - offset, "%%t [%d] %s %10s: ", getpid(),                         res.nodename, daemon);        } else {            offset += snprintf(fmt + offset, FMT_MAX - offset, "%%t [%d] %10s: ", getpid(), daemon);        }    }    if (crm_tracing_enabled() && method >= QB_LOG_STDERR) {        offset += snprintf(fmt + offset, FMT_MAX - offset, "(%%-12f:%%5l %%g) %%-7p: %%n: ");    } else {        offset += snprintf(fmt + offset, FMT_MAX - offset, "%%g %%-7p: %%n: ");    }    if (method == QB_LOG_SYSLOG) {        offset += snprintf(fmt + offset, FMT_MAX - offset, "%%b");    } else {        offset += snprintf(fmt + offset, FMT_MAX - offset, "/t%%b");    }    CRM_LOG_ASSERT(offset > 0);    qb_log_format_set(method, fmt);}
开发者ID:seabres,项目名称:pacemaker,代码行数:34,


示例7: crm_remote_header

static struct crm_remote_header_v0 *crm_remote_header(crm_remote_t * remote){    struct crm_remote_header_v0 *header = (struct crm_remote_header_v0 *)remote->buffer;    if(remote->buffer_offset < sizeof(struct crm_remote_header_v0)) {        return NULL;    } else if(header->endian != ENDIAN_LOCAL) {        uint32_t endian = __swab32(header->endian);        CRM_LOG_ASSERT(endian == ENDIAN_LOCAL);        if(endian != ENDIAN_LOCAL) {            crm_err("Invalid message detected, endian mismatch: %lx is neither %lx nor the swab'd %lx",                    ENDIAN_LOCAL, header->endian, endian);            return NULL;        }        header->id = __swab64(header->id);        header->flags = __swab64(header->flags);        header->endian = __swab32(header->endian);        header->version = __swab32(header->version);        header->size_total = __swab32(header->size_total);        header->payload_offset = __swab32(header->payload_offset);        header->payload_compressed = __swab32(header->payload_compressed);        header->payload_uncompressed = __swab32(header->payload_uncompressed);    }    return header;}
开发者ID:KevenChang,项目名称:pacemaker,代码行数:30,


示例8: cib_notify_client

gbooleancib_notify_client(gpointer key, gpointer value, gpointer user_data){    const char *type = NULL;    gboolean do_send = FALSE;    cib_client_t *client = value;    xmlNode *update_msg = user_data;    CRM_CHECK(client != NULL, return TRUE);    CRM_CHECK(update_msg != NULL, return TRUE);    if (client == NULL) {        crm_warn("Skipping NULL client");        return TRUE;    } else if (client->ipc == NULL) {        crm_warn("Skipping client with NULL channel");        return FALSE;    }    type = crm_element_value(update_msg, F_SUBTYPE);    CRM_LOG_ASSERT(type != NULL);    if (client->diffs && safe_str_eq(type, T_CIB_DIFF_NOTIFY)) {        do_send = TRUE;    } else if (client->replace && safe_str_eq(type, T_CIB_REPLACE_NOTIFY)) {        do_send = TRUE;    } else if (client->confirmations && safe_str_eq(type, T_CIB_UPDATE_CONFIRM)) {        do_send = TRUE;    } else if (client->pre_notify && safe_str_eq(type, T_CIB_PRE_NOTIFY)) {        do_send = TRUE;    } else if (client->post_notify && safe_str_eq(type, T_CIB_POST_NOTIFY)) {        do_send = TRUE;    }    if (do_send) {        if (client->ipc) {            if(crm_ipcs_send(client->ipc, update_msg, TRUE) == FALSE) {                crm_warn("Notification of client %s/%s failed", client->name, client->id);            }#ifdef HAVE_GNUTLS_GNUTLS_H        } else if (client->session) {            crm_debug("Sent %s notification to client %s/%s", type, client->name, client->id);            cib_send_remote_msg(client->session, update_msg, client->encrypted);#endif        } else {            crm_err("Unknown transport for %s", client->name);        }    }    return FALSE;}
开发者ID:esimone74,项目名称:pacemaker,代码行数:58,


示例9: join_query_callback

voidjoin_query_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void *user_data){    xmlNode *local_cib = NULL;    char *join_id = user_data;    xmlNode *generation = create_xml_node(NULL, XML_CIB_TAG_GENERATION_TUPPLE);    CRM_LOG_ASSERT(join_id != NULL);    query_call_id = 0;    if (rc == pcmk_ok) {        local_cib = output;        CRM_LOG_ASSERT(safe_str_eq(crm_element_name(local_cib), XML_TAG_CIB));    }    if (local_cib != NULL) {        xmlNode *reply = NULL;        crm_debug("Respond to join offer join-%s", join_id);        crm_debug("Acknowledging %s as our DC", fsa_our_dc);        copy_in_properties(generation, local_cib);        reply = create_request(CRM_OP_JOIN_REQUEST, generation, fsa_our_dc,                               CRM_SYSTEM_DC, CRM_SYSTEM_CRMD, NULL);        crm_xml_add(reply, F_CRM_JOIN_ID, join_id);        if (fsa_our_dc) {            send_cluster_message(crm_get_peer(0, fsa_our_dc), crm_msg_crmd, reply, TRUE);        } else {            crm_warn("No DC for join-%s", join_id);            send_cluster_message(NULL, crm_msg_crmd, reply, TRUE);        }        free_xml(reply);    } else {        crm_err("Could not retrieve Generation to attach to our"                " join acknowledgement: %s", pcmk_strerror(rc));        register_fsa_error_adv(C_FSA_INTERNAL, I_ERROR, NULL, NULL, __FUNCTION__);    }    free(join_id);    free_xml(generation);}
开发者ID:HyunKwangYong,项目名称:pacemaker,代码行数:44,


示例10: crm_client_new

crm_client_t *crm_client_new(qb_ipcs_connection_t * c, uid_t uid_client, gid_t gid_client){    static uid_t uid_server = 0;    static gid_t gid_cluster = 0;    crm_client_t *client = NULL;    CRM_LOG_ASSERT(c);    if (c == NULL) {        return NULL;    }    if (gid_cluster == 0) {        uid_server = getuid();        if(crm_user_lookup(CRM_DAEMON_USER, NULL, &gid_cluster) < 0) {            static bool have_error = FALSE;            if(have_error == FALSE) {                crm_warn("Could not find group for user %s", CRM_DAEMON_USER);                have_error = TRUE;            }        }    }    if(gid_cluster != 0 && gid_client != 0) {        uid_t best_uid = -1; /* Passing -1 to chown(2) means don't change */        if(uid_client == 0 || uid_server == 0) { /* Someone is priveliged, but the other may not be */            best_uid = QB_MAX(uid_client, uid_server);            crm_trace("Allowing user %u to clean up after disconnect", best_uid);        }        crm_trace("Giving access to group %u", gid_cluster);        qb_ipcs_connection_auth_set(c, best_uid, gid_cluster, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);    }    crm_client_init();    /* TODO: Do our own auth checking, return NULL if unauthorized */    client = calloc(1, sizeof(crm_client_t));    client->ipcs = c;    client->kind = CRM_CLIENT_IPC;    client->pid = crm_ipcs_client_pid(c);    client->id = crm_generate_uuid();    crm_debug("Connecting %p for uid=%d gid=%d pid=%u id=%s", c, uid_client, gid_client, client->pid, client->id);#if ENABLE_ACL    client->user = uid2username(uid_client);#endif    g_hash_table_insert(client_connections, c, client);    return client;}
开发者ID:credativ,项目名称:pacemaker,代码行数:56,


示例11: cib_cleanup_query

static intcib_cleanup_query(int options, xmlNode ** data, xmlNode ** output){    CRM_LOG_ASSERT(*data == NULL);    if ((options & cib_no_children)        || safe_str_eq(crm_element_name(*output), "xpath-query")) {        free_xml(*output);    }    return pcmk_ok;}
开发者ID:JamesGuthrie,项目名称:pacemaker,代码行数:10,


示例12: ipc_proxy_forward_client

voidipc_proxy_forward_client(crm_client_t *ipc_proxy, xmlNode *xml){    const char *session = crm_element_value(xml, F_LRMD_IPC_SESSION);    const char *msg_type = crm_element_value(xml, F_LRMD_IPC_OP);    xmlNode *msg = get_message_xml(xml, F_LRMD_IPC_MSG);    crm_client_t *ipc_client = crm_client_get_by_id(session);    int rc = 0;    if (ipc_client == NULL) {        xmlNode *msg = create_xml_node(NULL, T_LRMD_IPC_PROXY);        crm_xml_add(msg, F_LRMD_IPC_OP, "destroy");        crm_xml_add(msg, F_LRMD_IPC_SESSION, session);        lrmd_server_send_notify(ipc_proxy, msg);        free_xml(msg);        return;    }    /* This is an event or response from the ipc provider     * going to the local ipc client.     *     * Looking at the chain of events.     *     * -----remote node----------------|---- cluster node ------     * ipc_client <--1--> this code <--2--> crmd:remote_proxy_cb/remote_proxy_relay_event() <----3----> ipc server     *     * This function is receiving a msg from connection 2     * and forwarding it to connection 1.     */    if (safe_str_eq(msg_type, "event")) {        crm_info("Sending event to %s", ipc_client->id);        rc = crm_ipcs_send(ipc_client, 0, msg, crm_ipc_server_event);    } else if (safe_str_eq(msg_type, "response")) {        int msg_id = 0;        crm_element_value_int(xml, F_LRMD_IPC_MSG_ID, &msg_id);        crm_info("Sending response to %d - %s", ipc_client->request_id, ipc_client->id);        rc = crm_ipcs_send(ipc_client, msg_id, msg, FALSE);        CRM_LOG_ASSERT(msg_id == ipc_client->request_id);        ipc_client->request_id = 0;    } else if (safe_str_eq(msg_type, "destroy")) {        qb_ipcs_disconnect(ipc_client->ipcs);    } else {        crm_err("Unknown ipc proxy msg type %s" , msg_type);    }    if (rc < 0) {        crm_warn("IPC Proxy send to ipc client %s failed, rc = %d", ipc_client->id, rc);    }}
开发者ID:SynetoNet,项目名称:pacemaker,代码行数:55,


示例13: stonith_xml_history_to_list

/*! * /internal * /brief Convert xml fence-history to a hash-table like stonith_remote_op_list * * /param[in] history   Fence-history in xml * * /return Fence-history as hash-table */static GHashTable *stonith_xml_history_to_list(xmlNode *history){    xmlNode *xml_op = NULL;    GHashTable *rv = NULL;    init_stonith_remote_op_hash_table(&rv);    CRM_LOG_ASSERT(rv != NULL);    for (xml_op = __xml_first_child(history); xml_op != NULL;         xml_op = __xml_next(xml_op)) {        remote_fencing_op_t *op = NULL;        char *id = crm_element_value_copy(xml_op, F_STONITH_REMOTE_OP_ID);        int completed, state;        if (!id) {            crm_warn("History to convert to hashtable has no id in entry");            continue;        }        crm_trace("Attaching op %s to hashtable", id);        op = calloc(1, sizeof(remote_fencing_op_t));        op->id = id;        op->target = crm_element_value_copy(xml_op, F_STONITH_TARGET);        op->action = crm_element_value_copy(xml_op, F_STONITH_ACTION);        op->originator = crm_element_value_copy(xml_op, F_STONITH_ORIGIN);        op->delegate = crm_element_value_copy(xml_op, F_STONITH_DELEGATE);        op->client_name = crm_element_value_copy(xml_op, F_STONITH_CLIENTNAME);        crm_element_value_int(xml_op, F_STONITH_DATE, &completed);        op->completed = (time_t) completed;        crm_element_value_int(xml_op, F_STONITH_STATE, &state);        op->state = (enum op_state) state;        g_hash_table_replace(rv, id, op);        CRM_LOG_ASSERT(g_hash_table_lookup(rv, id) != NULL);    }    return rv;}
开发者ID:ClusterLabs,项目名称:pacemaker,代码行数:50,


示例14: cib_common_callback

int32_tcib_common_callback(qb_ipcs_connection_t * c, void *data, size_t size, gboolean privileged){    uint32_t id = 0;    uint32_t flags = 0;    int call_options = 0;    crm_client_t *cib_client = crm_client_get(c);    xmlNode *op_request = crm_ipcs_recv(cib_client, data, size, &id, &flags);    if (op_request) {        crm_element_value_int(op_request, F_CIB_CALLOPTS, &call_options);    }    if (op_request == NULL) {        crm_trace("Invalid message from %p", c);        crm_ipcs_send_ack(cib_client, id, flags, "nack", __FUNCTION__, __LINE__);        return 0;    } else if(cib_client == NULL) {        crm_trace("Invalid client %p", c);        return 0;    }    if (is_set(call_options, cib_sync_call)) {        CRM_ASSERT(flags & crm_ipc_client_response);        CRM_LOG_ASSERT(cib_client->request_id == 0);    /* This means the client has two synchronous events in-flight */        cib_client->request_id = id;    /* Reply only to the last one */    }    if (cib_client->name == NULL) {        const char *value = crm_element_value(op_request, F_CIB_CLIENTNAME);        if (value == NULL) {            cib_client->name = crm_itoa(cib_client->pid);        } else {            cib_client->name = strdup(value);        }    }    crm_xml_add(op_request, F_CIB_CLIENTID, cib_client->id);    crm_xml_add(op_request, F_CIB_CLIENTNAME, cib_client->name);#if ENABLE_ACL    CRM_ASSERT(cib_client->user != NULL);    crm_acl_get_set_user(op_request, F_CIB_USER, cib_client->user);#endif    crm_log_xml_trace(op_request, "Client[inbound]");    cib_common_callback_worker(id, flags, op_request, cib_client, privileged);    free_xml(op_request);    return 0;}
开发者ID:SynetoNet,项目名称:pacemaker,代码行数:54,


示例15: systemd_unit_by_name

static char *systemd_unit_by_name(const gchar * arg_name, svc_action_t *op){    DBusMessage *msg;    DBusMessage *reply = NULL;    DBusPendingCall* pending = NULL;    char *name = NULL;/*  Equivalent to GetUnit if its already loaded  <method name="LoadUnit">   <arg name="name" type="s" direction="in"/>   <arg name="unit" type="o" direction="out"/>  </method> */    if (systemd_init() == FALSE) {        return FALSE;    }    msg = systemd_new_method(BUS_NAME".Manager", "LoadUnit");    CRM_ASSERT(msg != NULL);    name = systemd_service_name(arg_name);    CRM_LOG_ASSERT(dbus_message_append_args(msg, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID));    free(name);    if(op == NULL || op->synchronous) {        const char *unit = NULL;        char *munit = NULL;        DBusError error;        dbus_error_init(&error);        reply = pcmk_dbus_send_recv(msg, systemd_proxy, &error, op? op->timeout : DBUS_TIMEOUT_USE_DEFAULT);        dbus_message_unref(msg);        unit = systemd_loadunit_result(reply, op);        if(unit) {            munit = strdup(unit);        }        if(reply) {            dbus_message_unref(reply);        }        return munit;    }    pending = pcmk_dbus_send(msg, systemd_proxy, systemd_loadunit_cb, op, op->timeout);    if(pending) {        services_set_op_pending(op, pending);    }    dbus_message_unref(msg);    return NULL;}
开发者ID:tradej,项目名称:pacemaker,代码行数:54,


示例16: upstart_job_by_name

static gbooleanupstart_job_by_name(const gchar * arg_name, gchar ** out_unit, int timeout){/*  com.ubuntu.Upstart0_6.GetJobByName (in String name, out ObjectPath job)*/    DBusError error;    DBusMessage *msg;    DBusMessage *reply = NULL;    const char *method = "GetJobByName";    if(upstart_init() == FALSE) {        return FALSE;    }    msg = dbus_message_new_method_call(BUS_NAME, // target for the method call                                       BUS_PATH, // object to call on                                       UPSTART_06_API, // interface to call on                                       method); // method name    dbus_error_init(&error);    CRM_LOG_ASSERT(dbus_message_append_args(msg, DBUS_TYPE_STRING, &arg_name, DBUS_TYPE_INVALID));    reply = pcmk_dbus_send_recv(msg, upstart_proxy, &error, timeout);    dbus_message_unref(msg);    if(error.name) {        /* ignore "already started" or "not running" errors */        crm_err("Could not issue %s for %s: %s", method, arg_name, error.name);    } else if(!pcmk_dbus_type_check(reply, NULL, DBUS_TYPE_OBJECT_PATH, __FUNCTION__, __LINE__)) {        crm_err("Invalid return type for %s", method);    } else {        if(out_unit) {            char *path = NULL;            dbus_message_get_args (reply, NULL,                                   DBUS_TYPE_OBJECT_PATH, &path,                                   DBUS_TYPE_INVALID);            *out_unit = strdup(path);        }        dbus_message_unref(reply);        return TRUE;    }    if(reply) {        dbus_message_unref(reply);    }    return FALSE;}
开发者ID:beess,项目名称:pacemaker,代码行数:50,


示例17: crm_client_new

crm_client_t *crm_client_new(qb_ipcs_connection_t * c, uid_t uid_client, gid_t gid_client){    static gid_t uid_cluster = 0;    static gid_t gid_cluster = 0;    crm_client_t *client = NULL;    CRM_LOG_ASSERT(c);    if (c == NULL) {        return NULL;    }    if (uid_cluster == 0) {        if (crm_user_lookup(CRM_DAEMON_USER, &uid_cluster, &gid_cluster) < 0) {            static bool have_error = FALSE;            if(have_error == FALSE) {                crm_warn("Could not find user and group IDs for user %s",                         CRM_DAEMON_USER);                have_error = TRUE;            }        }    }    if (uid_client != 0) {        crm_trace("Giving access to group %u", gid_cluster);        /* Passing -1 to chown(2) means don't change */        qb_ipcs_connection_auth_set(c, -1, gid_cluster, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);    }    crm_client_init();    /* TODO: Do our own auth checking, return NULL if unauthorized */    client = crm_client_alloc(c);    client->ipcs = c;    client->kind = CRM_CLIENT_IPC;    client->pid = crm_ipcs_client_pid(c);    if ((uid_client == 0) || (uid_client == uid_cluster)) {        /* Remember when a connection came from root or hacluster */        set_bit(client->flags, crm_client_flag_ipc_privileged);    }    crm_debug("Connecting %p for uid=%d gid=%d pid=%u id=%s", c, uid_client, gid_client, client->pid, client->id);#if ENABLE_ACL    client->user = uid2username(uid_client);#endif    return client;}
开发者ID:beekhof,项目名称:pacemaker,代码行数:50,


示例18: send_peer_reply

static gbooleansend_peer_reply(xmlNode * msg, xmlNode * result_diff, const char *originator, gboolean broadcast){    CRM_ASSERT(msg != NULL);    if (broadcast) {        /* this (successful) call modified the CIB _and_ the         * change needs to be broadcast...         *   send via HA to other nodes         */        int diff_add_updates = 0;        int diff_add_epoch = 0;        int diff_add_admin_epoch = 0;        int diff_del_updates = 0;        int diff_del_epoch = 0;        int diff_del_admin_epoch = 0;        const char *digest = NULL;        CRM_LOG_ASSERT(result_diff != NULL);        digest = crm_element_value(result_diff, XML_ATTR_DIGEST);        cib_diff_version_details(result_diff,                                 &diff_add_admin_epoch, &diff_add_epoch, &diff_add_updates,                                 &diff_del_admin_epoch, &diff_del_epoch, &diff_del_updates);        crm_trace("Sending update diff %d.%d.%d -> %d.%d.%d %s",                  diff_del_admin_epoch, diff_del_epoch, diff_del_updates,                  diff_add_admin_epoch, diff_add_epoch, diff_add_updates, digest);        crm_xml_add(msg, F_CIB_ISREPLY, originator);        crm_xml_add(msg, F_CIB_GLOBAL_UPDATE, XML_BOOLEAN_TRUE);        crm_xml_add(msg, F_CIB_OPERATION, CIB_OP_APPLY_DIFF);        CRM_ASSERT(digest != NULL);        add_message_xml(msg, F_CIB_UPDATE_DIFF, result_diff);        crm_log_xml_explicit(msg, "copy");        return send_cluster_message(NULL, crm_msg_cib, msg, TRUE);    } else if (originator != NULL) {        /* send reply via HA to originating node */        crm_trace("Sending request result to %s only", originator);        crm_xml_add(msg, F_CIB_ISREPLY, originator);        return send_cluster_message(crm_get_peer(0, originator), crm_msg_cib, msg, FALSE);    }    return FALSE;}
开发者ID:SynetoNet,项目名称:pacemaker,代码行数:49,


示例19: upstart_async_dispatch

static voidupstart_async_dispatch(DBusPendingCall *pending, void *user_data){    DBusError error;    DBusMessage *reply = NULL;    svc_action_t *op = user_data;    dbus_error_init(&error);    if(pending) {        reply = dbus_pending_call_steal_reply(pending);    }    if (pcmk_dbus_find_error(pending, reply, &error)) {        /* ignore "already started" or "not running" errors */        if (!upstart_mask_error(op, error.name)) {            crm_err("%s for %s: %s", op->action, op->rsc, error.message);        }        dbus_error_free(&error);    } else if (!g_strcmp0(op->action, "stop")) {        /* No return vaue */        op->rc = PCMK_OCF_OK;    } else {        if(!pcmk_dbus_type_check(reply, NULL, DBUS_TYPE_OBJECT_PATH, __FUNCTION__, __LINE__)) {            crm_warn("Call to %s passed but return type was unexpected", op->action);            op->rc = PCMK_OCF_OK;        } else {            const char *path = NULL;            dbus_message_get_args (reply, NULL,                                   DBUS_TYPE_OBJECT_PATH, &path,                                   DBUS_TYPE_INVALID);            crm_info("Call to %s passed: %s", op->action, path);            op->rc = PCMK_OCF_OK;        }    }    CRM_LOG_ASSERT(pending == op->opaque->pending);    services_set_op_pending(op, NULL);    operation_finalize(op);    if(reply) {        dbus_message_unref(reply);    }}
开发者ID:oalbrigt,项目名称:pacemaker,代码行数:48,


示例20: st_ipc_dispatch

/* Exit code means? */static int32_tst_ipc_dispatch(qb_ipcs_connection_t * qbc, void *data, size_t size){    uint32_t id = 0;    uint32_t flags = 0;    int call_options = 0;    xmlNode *request = NULL;    crm_client_t *c = crm_client_get(qbc);    if (c == NULL) {        crm_info("Invalid client: %p", qbc);        return 0;    }    request = crm_ipcs_recv(c, data, size, &id, &flags);    if (request == NULL) {        crm_ipcs_send_ack(c, id, flags, "nack", __FUNCTION__, __LINE__);        return 0;    }    if (c->name == NULL) {        const char *value = crm_element_value(request, F_STONITH_CLIENTNAME);        if (value == NULL) {            value = "unknown";        }        c->name = g_strdup_printf("%s.%u", value, c->pid);    }    crm_element_value_int(request, F_STONITH_CALLOPTS, &call_options);    crm_trace("Flags %u/%u for command %u from %s", flags, call_options, id, crm_client_name(c));    if (is_set(call_options, st_opt_sync_call)) {        CRM_ASSERT(flags & crm_ipc_client_response);        CRM_LOG_ASSERT(c->request_id == 0);     /* This means the client has two synchronous events in-flight */        c->request_id = id;     /* Reply only to the last one */    }    crm_xml_add(request, F_STONITH_CLIENTID, c->id);    crm_xml_add(request, F_STONITH_CLIENTNAME, crm_client_name(c));    crm_xml_add(request, F_STONITH_CLIENTNODE, stonith_our_uname);    crm_log_xml_trace(request, "Client[inbound]");    stonith_command(c, id, flags, request, NULL);    free_xml(request);    return 0;}
开发者ID:efenshi,项目名称:pacemaker,代码行数:49,


示例21: do_cl_join_offer_respond

/* aka. accept the welcome offer */voiddo_cl_join_offer_respond(long long action,                         enum crmd_fsa_cause cause,                         enum crmd_fsa_state cur_state,                         enum crmd_fsa_input current_input, fsa_data_t * msg_data){    ha_msg_input_t *input = fsa_typed_data(fsa_dt_ha_msg);    const char *welcome_from = crm_element_value(input->msg, F_CRM_HOST_FROM);    const char *join_id = crm_element_value(input->msg, F_CRM_JOIN_ID);#if 0    if (we are sick) {        log error;        /* save the request for later? */        return;    }#endif    crm_trace("Accepting cluster join offer from node %s "CRM_XS" join-%s",              welcome_from, crm_element_value(input->msg, F_CRM_JOIN_ID));    /* we only ever want the last one */    if (query_call_id > 0) {        crm_trace("Cancelling previous join query: %d", query_call_id);        remove_cib_op_callback(query_call_id, FALSE);        query_call_id = 0;    }    if (update_dc(input->msg) == FALSE) {        crm_warn("Discarding cluster join offer from node %s (expected %s)",                 welcome_from, fsa_our_dc);        return;    }    update_dc_expected(input->msg);    CRM_LOG_ASSERT(input != NULL);    query_call_id =        fsa_cib_conn->cmds->query(fsa_cib_conn, NULL, NULL, cib_scope_local | cib_no_children);    fsa_register_cib_callback(query_call_id, FALSE, strdup(join_id), join_query_callback);    crm_trace("Registered join query callback: %d", query_call_id);    register_fsa_action(A_DC_TIMER_STOP);}
开发者ID:bubble75,项目名称:pacemaker,代码行数:46,


示例22: systemd_async_dispatch

static voidsystemd_async_dispatch(DBusPendingCall *pending, void *user_data){    DBusMessage *reply = NULL;    svc_action_t *op = user_data;    if(pending) {        reply = dbus_pending_call_steal_reply(pending);    }    crm_trace("Got result: %p for %p for %s, %s", reply, pending, op->rsc, op->action);    CRM_LOG_ASSERT(pending == op->opaque->pending);    services_set_op_pending(op, NULL);    systemd_exec_result(reply, op);    if(reply) {        dbus_message_unref(reply);    }}
开发者ID:oalbrigt,项目名称:pacemaker,代码行数:20,


示例23: do_local_reply

voiddo_local_reply(xmlNode * notify_src, const char *client_id, gboolean sync_reply, gboolean from_peer){    /* send callback to originating child */    crm_client_t *client_obj = NULL;    int local_rc = pcmk_ok;    crm_trace("Sending response");    client_obj = crm_client_get_by_id(client_id);    crm_trace("Sending callback to request originator");    if (client_obj == NULL) {        local_rc = -1;        crm_trace("No client to sent the response to.  F_STONITH_CLIENTID not set.");    } else {        int rid = 0;        if (sync_reply) {            CRM_LOG_ASSERT(client_obj->request_id);            rid = client_obj->request_id;            client_obj->request_id = 0;            crm_trace("Sending response %d to %s %s",                      rid, client_obj->name, from_peer ? "(originator of delegated request)" : "");        } else {            crm_trace("Sending an event to %s %s",                      client_obj->name, from_peer ? "(originator of delegated request)" : "");        }        local_rc = crm_ipcs_send(client_obj, rid, notify_src, sync_reply?crm_ipc_flags_none:crm_ipc_server_event);    }    if (local_rc < pcmk_ok && client_obj != NULL) {        crm_warn("%sSync reply to %s failed: %s",                 sync_reply ? "" : "A-",                 client_obj ? client_obj->name : "<unknown>", pcmk_strerror(local_rc));    }}
开发者ID:SynetoNet,项目名称:pacemaker,代码行数:41,


示例24: systemd_loadunit_cb

static voidsystemd_loadunit_cb(DBusPendingCall *pending, void *user_data){    DBusMessage *reply = NULL;    svc_action_t * op = user_data;    if(pending) {        reply = dbus_pending_call_steal_reply(pending);    }    crm_trace("Got result: %p for %p / %p for %s", reply, pending, op->opaque->pending, op->id);    CRM_LOG_ASSERT(pending == op->opaque->pending);    services_set_op_pending(op, NULL);    systemd_loadunit_result(reply, user_data);    if(reply) {        dbus_message_unref(reply);    }}
开发者ID:tradej,项目名称:pacemaker,代码行数:21,


示例25: join_query_callback

voidjoin_query_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void *user_data){    char *join_id = user_data;    xmlNode *generation = create_xml_node(NULL, XML_CIB_TAG_GENERATION_TUPPLE);    CRM_LOG_ASSERT(join_id != NULL);    if (query_call_id != call_id) {        crm_trace("Query %d superceeded", call_id);        goto done;    }    query_call_id = 0;    if(rc != pcmk_ok || output == NULL) {        crm_err("Could not retrieve version details for join-%s: %s (%d)",                join_id, pcmk_strerror(rc), rc);        register_fsa_error_adv(C_FSA_INTERNAL, I_ERROR, NULL, NULL, __FUNCTION__);    } else if (fsa_our_dc == NULL) {        crm_debug("Membership is in flux, not continuing join-%s", join_id);    } else {        xmlNode *reply = NULL;        crm_debug("Respond to join offer join-%s from %s", join_id, fsa_our_dc);        copy_in_properties(generation, output);        reply = create_request(CRM_OP_JOIN_REQUEST, generation, fsa_our_dc,                               CRM_SYSTEM_DC, CRM_SYSTEM_CRMD, NULL);        crm_xml_add(reply, F_CRM_JOIN_ID, join_id);        send_cluster_message(crm_get_peer(0, fsa_our_dc), crm_msg_crmd, reply, TRUE);        free_xml(reply);    }  done:    free_xml(generation);    free(join_id);}
开发者ID:AnchorCat,项目名称:pacemaker,代码行数:40,


示例26: crm_element_value

remote_fencing_op_t *initiate_remote_stonith_op(stonith_client_t *client, xmlNode *request, gboolean manual_ack){    xmlNode *query = NULL;    const char *client_id = NULL;    remote_fencing_op_t *op = NULL;    if(client) {        client_id = client->id;    } else {        client_id = crm_element_value(request, F_STONITH_CLIENTID);    }    CRM_LOG_ASSERT(client_id != NULL);    op = create_remote_stonith_op(client_id, request, FALSE);    query = stonith_create_op(0, op->id, STONITH_OP_QUERY, NULL, 0);    if(!manual_ack) {        op->op_timer = g_timeout_add(1200*op->base_timeout, remote_op_timeout, op);        op->query_timer = g_timeout_add(100*op->base_timeout, remote_op_query_timeout, op);    } else {        crm_xml_add(query, F_STONITH_DEVICE, "manual_ack");    }    crm_xml_add(query, F_STONITH_REMOTE, op->id);    crm_xml_add(query, F_STONITH_TARGET, op->target);    crm_xml_add(query, F_STONITH_ACTION, op->action);    crm_xml_add(query, F_STONITH_OWNER,  op->originator);    crm_xml_add(query, F_STONITH_CLIENTID, op->client_id);    crm_xml_add(query, F_STONITH_CLIENTNAME, op->client_name);    crm_xml_add_int(query, F_STONITH_TIMEOUT, op->base_timeout);    crm_info("Initiating remote operation %s for %s: %s", op->action, op->target, op->id);    CRM_CHECK(op->action, return NULL);    send_cluster_message(NULL, crm_msg_stonith_ng, query, FALSE);    free_xml(query);    return op;}
开发者ID:Xarthisius,项目名称:pacemaker,代码行数:40,


示例27: generate_fail_regex

/*! * /internal * /brief Compile regular expression to match a failure-related node attribute * * /param[in]  prefix    Attribute prefix to match * /param[in]  rsc_name  Resource name to match as used in failure attributes * /param[in]  is_legacy Whether DC uses per-resource fail counts * /param[in]  is_unique Whether the resource is a globally unique clone * /param[out] re        Where to store resulting regular expression * * /note Fail attributes are named like PREFIX-RESOURCE#OP_INTERVAL. *       The caller is responsible for freeing re with regfree(). */static voidgenerate_fail_regex(const char *prefix, const char *rsc_name,                    gboolean is_legacy, gboolean is_unique, regex_t *re){    char *pattern;    /* @COMPAT DC < 1.1.17: Fail counts used to be per-resource rather than     * per-operation.     */    const char *op_pattern = (is_legacy? "" : "#.+_[0-9]+");    /* Ignore instance numbers for anything other than globally unique clones.     * Anonymous clone fail counts could contain an instance number if the     * clone was initially unique, failed, then was converted to anonymous.     * @COMPAT Also, before 1.1.8, anonymous clone fail counts always contained     * clone instance numbers.     */    const char *instance_pattern = (is_unique? "" : "(:[0-9]+)?");    pattern = crm_strdup_printf("^%s-%s%s%s$", prefix, rsc_name,                                instance_pattern, op_pattern);    CRM_LOG_ASSERT(regcomp(re, pattern, REG_EXTENDED|REG_NOSUB) == 0);    free(pattern);}
开发者ID:beekhof,项目名称:pacemaker,代码行数:37,


示例28: crm_element_value

/*! * /brief Retrieve the value of an XML attribute * * /param[in] data   XML node to check * /param[in] name   Attribute name to check * * /return Value of specified attribute (may be /c NULL) */const char *crm_element_value(const xmlNode *data, const char *name){    xmlAttr *attr = NULL;    if (data == NULL) {        crm_err("Couldn't find %s in NULL", name ? name : "<null>");        CRM_LOG_ASSERT(data != NULL);        return NULL;    } else if (name == NULL) {        crm_err("Couldn't find NULL in %s", crm_element_name(data));        return NULL;    }    /* The first argument to xmlHasProp() has always been const,     * but libxml2 <2.9.2 didn't declare that, so cast it     */    attr = xmlHasProp((xmlNode *) data, (const xmlChar *)name);    if (!attr || !attr->children) {        return NULL;    }    return (const char *) attr->children->content;}
开发者ID:wenningerk,项目名称:pacemaker,代码行数:32,


示例29: find_nvpair_attr_delegate

extern intfind_nvpair_attr_delegate(cib_t * the_cib, const char *attr, const char *section,                          const char *node_uuid, const char *attr_set_type, const char *set_name,                          const char *attr_id, const char *attr_name, gboolean to_console,                          char **value, const char *user_name){    int offset = 0;    static int xpath_max = 1024;    int rc = pcmk_ok;    char *xpath_string = NULL;    xmlNode *xml_search = NULL;    const char *set_type = NULL;    const char *node_type = NULL;    if (attr_set_type) {        set_type = attr_set_type;    } else {        set_type = XML_TAG_ATTR_SETS;    }    CRM_ASSERT(value != NULL);    *value = NULL;    if (safe_str_eq(section, XML_CIB_TAG_CRMCONFIG)) {        node_uuid = NULL;        set_type = XML_CIB_TAG_PROPSET;    } else if (safe_str_eq(section, XML_CIB_TAG_OPCONFIG)               || safe_str_eq(section, XML_CIB_TAG_RSCCONFIG)) {        node_uuid = NULL;        set_type = XML_TAG_META_SETS;    } else if (safe_str_eq(section, XML_CIB_TAG_TICKETS)) {        node_uuid = NULL;        section = XML_CIB_TAG_STATUS;        node_type = XML_CIB_TAG_TICKETS;    } else if (node_uuid == NULL) {        return -EINVAL;    }    xpath_string = calloc(1, xpath_max);    if (xpath_string == NULL) {        crm_perror(LOG_CRIT, "Could not create xpath");        return -ENOMEM;    }    attr_snprintf(xpath_string, offset, xpath_max, "%.128s", get_object_path(section));    if (safe_str_eq(node_type, XML_CIB_TAG_TICKETS)) {        attr_snprintf(xpath_string, offset, xpath_max, "//%s", node_type);    } else if (node_uuid) {        const char *node_type = XML_CIB_TAG_NODE;        if (safe_str_eq(section, XML_CIB_TAG_STATUS)) {            node_type = XML_CIB_TAG_STATE;            set_type = XML_TAG_TRANSIENT_NODEATTRS;        }        attr_snprintf(xpath_string, offset, xpath_max, "//%s[@id='%s']", node_type,                      node_uuid);    }    if (set_name) {        attr_snprintf(xpath_string, offset, xpath_max, "//%s[@id='%.128s']", set_type,                      set_name);    } else {        attr_snprintf(xpath_string, offset, xpath_max, "//%s", set_type);    }    attr_snprintf(xpath_string, offset, xpath_max, "//nvpair[");    if (attr_id) {        attr_snprintf(xpath_string, offset, xpath_max, "@id='%s'", attr_id);    }    if (attr_name) {        if (attr_id) {            attr_snprintf(xpath_string, offset, xpath_max, " and ");        }        attr_snprintf(xpath_string, offset, xpath_max, "@name='%.128s'", attr_name);    }    attr_snprintf(xpath_string, offset, xpath_max, "]");    CRM_LOG_ASSERT(offset > 0);    rc = cib_internal_op(the_cib, CIB_OP_QUERY, NULL, xpath_string, NULL, &xml_search,                         cib_sync_call | cib_scope_local | cib_xpath, user_name);    if (rc != pcmk_ok) {        crm_trace("Query failed for attribute %s (section=%s, node=%s, set=%s, xpath=%s): %s",                  attr_name, section, crm_str(node_uuid), crm_str(set_name), xpath_string,                  pcmk_strerror(rc));        goto done;    }    crm_log_xml_debug(xml_search, "Match");    if (xml_has_children(xml_search)) {        xmlNode *child = NULL;        rc = -ENOTUNIQ;//.........这里部分代码省略.........
开发者ID:qezz,项目名称:pacemaker,代码行数:101,



注:本文中的CRM_LOG_ASSERT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ CROSS函数代码示例
C++ CRM_CHECK函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。