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

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

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

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

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

示例1: process_graph_event

gbooleanprocess_graph_event(xmlNode * event, const char *event_node){    int rc = -1;    int status = -1;    int callid = -1;    int action = -1;    int target_rc = -1;    int transition_num = -1;    char *update_te_uuid = NULL;    gboolean stop_early = FALSE;    gboolean passed = FALSE;    const char *id = NULL;    const char *desc = NULL;    const char *magic = NULL;    CRM_ASSERT(event != NULL);/*<lrm_rsc_op id="rsc_east-05_last_0" operation_key="rsc_east-05_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.6" transition-key="9:2:7:be2e97d9-05e2-439d-863e-48f7aecab2aa" transition-magic="0:7;9:2:7:be2e97d9-05e2-439d-863e-48f7aecab2aa" call-id="17" rc-code="7" op-status="0" interval="0" last-run="1355361636" last-rc-change="1355361636" exec-time="128" queue-time="0" op-digest="c81f5f40b1c9e859c992e800b1aa6972"/>*/    id = crm_element_value(event, XML_LRM_ATTR_TASK_KEY);    crm_element_value_int(event, XML_LRM_ATTR_RC, &rc);    crm_element_value_int(event, XML_LRM_ATTR_OPSTATUS, &status);    crm_element_value_int(event, XML_LRM_ATTR_CALLID, &callid);    magic = crm_element_value(event, XML_ATTR_TRANSITION_KEY);    if (magic == NULL) {        /* non-change */        return FALSE;    }    if (decode_transition_key(magic, &update_te_uuid, &transition_num, &action, &target_rc) ==        FALSE) {        crm_err("Invalid event %s.%d detected: %s", id, callid, magic);        abort_transition(INFINITY, tg_restart, "Bad event", event);        return FALSE;    }    if (status == PCMK_LRM_OP_PENDING) {        goto bail;    }    if (transition_num == -1) {        desc = "initiated outside of the cluster";        abort_transition(INFINITY, tg_restart, "Unexpected event", event);    } else if (action < 0 || crm_str_eq(update_te_uuid, te_uuid, TRUE) == FALSE) {        desc = "initiated by a different node";        abort_transition(INFINITY, tg_restart, "Foreign event", event);        stop_early = TRUE;      /* This could be an lrm status refresh */    } else if (transition_graph->id != transition_num) {        desc = "arrived really late";        abort_transition(INFINITY, tg_restart, "Old event", event);        stop_early = TRUE;      /* This could be an lrm status refresh */    } else if (transition_graph->complete) {        desc = "arrived late";        abort_transition(INFINITY, tg_restart, "Inactive graph", event);    } else if (match_graph_event(action, event, event_node, status, rc, target_rc) < 0) {        desc = "unknown";        abort_transition(INFINITY, tg_restart, "Unknown event", event);    } else if (rc == target_rc) {        passed = TRUE;        crm_trace("Processed update to %s: %s", id, magic);    }    if (passed == FALSE) {        if (update_failcount(event, event_node, rc, target_rc, transition_num == -1)) {            /* Turns out this wasn't an lrm status refresh update aferall */            stop_early = FALSE;            desc = "failed";        }        crm_info("Detected action (%d.%d) %s.%d=%s: %s", transition_num, action, id, callid,                 services_ocf_exitcode_str(rc), desc);    }  bail:    free(update_te_uuid);    return stop_early;}
开发者ID:HyunKwangYong,项目名称:pacemaker,代码行数:87,


示例2: convert_ha_field

static voidconvert_ha_field(xmlNode * parent, void *msg_v, int lpc){    int type = 0;    const char *name = NULL;    const char *value = NULL;    xmlNode *xml = NULL;    HA_Message *msg = msg_v;    int rc = BZ_OK;    size_t orig_len = 0;    unsigned int used = 0;    char *uncompressed = NULL;    char *compressed = NULL;    int size = orig_len * 10;    CRM_CHECK(parent != NULL, return);    CRM_CHECK(msg != NULL, return);    name = msg->names[lpc];    type = cl_get_type(msg, name);    switch (type) {        case FT_STRUCT:            convert_ha_message(parent, msg->values[lpc], name);            break;        case FT_COMPRESS:        case FT_UNCOMPRESS:            convert_ha_message(parent, cl_get_struct(msg, name), name);            break;        case FT_STRING:            value = msg->values[lpc];            CRM_CHECK(value != NULL, return);            crm_trace("Converting %s/%d/%s", name, type, value[0] == '<' ? "xml" : "field");            if (value[0] != '<') {                crm_xml_add(parent, name, value);                break;            }            /* unpack xml string */            xml = string2xml(value);            if (xml == NULL) {                crm_err("Conversion of field '%s' failed", name);                return;            }            add_node_nocopy(parent, NULL, xml);            break;        case FT_BINARY:            value = cl_get_binary(msg, name, &orig_len);            size = orig_len * 10 + 1;   /* +1 because an exact 10x compression factor happens occasionally */            if (orig_len < 3 || value[0] != 'B' || value[1] != 'Z' || value[2] != 'h') {                if (strstr(name, "uuid") == NULL) {                    crm_err("Skipping non-bzip binary field: %s", name);                }                return;            }            compressed = calloc(1, orig_len);            memcpy(compressed, value, orig_len);            crm_trace("Trying to decompress %d bytes", (int)orig_len);  retry:            uncompressed = realloc_safe(uncompressed, size);            memset(uncompressed, 0, size);            used = size - 1;    /* always leave room for a trailing '/0'                                 * BZ2_bzBuffToBuffDecompress won't say anything if                                 * the uncompressed data is exactly 'size' bytes                                 */            rc = BZ2_bzBuffToBuffDecompress(uncompressed, &used, compressed, orig_len, 1, 0);            if (rc == BZ_OUTBUFF_FULL) {                size = size * 2;                /* don't try to allocate more memory than we have */                if (size > 0) {                    goto retry;                }            }            if (rc != BZ_OK) {                crm_err("Decompression of %s (%d bytes) into %d failed: %d",                        name, (int)orig_len, size, rc);            } else if (used >= size) {                CRM_ASSERT(used < size);            } else {                CRM_LOG_ASSERT(uncompressed[used] == 0);                uncompressed[used] = 0;                xml = string2xml(uncompressed);            }            if (xml != NULL) {                add_node_copy(parent, xml);                free_xml(xml);            }//.........这里部分代码省略.........
开发者ID:bubble75,项目名称:pacemaker,代码行数:101,


示例3: upstart_job_listall

GList *upstart_job_listall(void){    GList *units = NULL;    DBusMessageIter args;    DBusMessageIter unit;    DBusMessage *msg = NULL;    DBusMessage *reply = NULL;    const char *method = "GetAllJobs";    DBusError error;    int lpc = 0;    if (upstart_init() == FALSE) {        return NULL;    }/*  com.ubuntu.Upstart0_6.GetAllJobs (out <Array of ObjectPath> jobs)*/    dbus_error_init(&error);    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    CRM_ASSERT(msg != NULL);    reply = pcmk_dbus_send_recv(msg, upstart_proxy, &error, DBUS_TIMEOUT_USE_DEFAULT);    dbus_message_unref(msg);    if(error.name) {        crm_err("Call to %s failed: %s", method, error.name);        return NULL;    } else if (!dbus_message_iter_init(reply, &args)) {        crm_err("Call to %s failed: Message has no arguments", method);        dbus_message_unref(reply);        return NULL;    }    if(!pcmk_dbus_type_check(reply, &args, DBUS_TYPE_ARRAY, __FUNCTION__, __LINE__)) {        crm_err("Call to %s failed: Message has invalid arguments", method);        dbus_message_unref(reply);        return NULL;    }    dbus_message_iter_recurse(&args, &unit);    while (dbus_message_iter_get_arg_type (&unit) != DBUS_TYPE_INVALID) {        DBusBasicValue value;        const char *job = NULL;        char *path = NULL;        if(!pcmk_dbus_type_check(reply, &unit, DBUS_TYPE_OBJECT_PATH, __FUNCTION__, __LINE__)) {            continue;        }        dbus_message_iter_get_basic(&unit, &value);        if(value.str) {            int llpc = 0;            path = value.str;            job = value.str;            while (path[llpc] != 0) {                if (path[llpc] == '/') {                    job = path + llpc + 1;                }                llpc++;            }            lpc++;            crm_trace("%s -> %s/n", path, job);            units = g_list_append(units, fix_upstart_name(job));        }        dbus_message_iter_next (&unit);    }    dbus_message_unref(reply);    crm_trace("Found %d upstart jobs", lpc);    return units;}
开发者ID:beess,项目名称:pacemaker,代码行数:79,


示例4: crm_remote_parse_buffer

/*! * /internal * /brief handles the recv buffer and parsing out msgs. * /note new_data is owned by this function once it is passed in. */xmlNode *crm_remote_parse_buffer(crm_remote_t * remote){    xmlNode *xml = NULL;    struct crm_remote_header_v0 *header = crm_remote_header(remote);    if (remote->buffer == NULL || header == NULL) {        return NULL;    }    /* take ownership of the buffer */    remote->buffer_offset = 0;    /* Support compression on the receiving end now, in case we ever want to add it later */    if (header->payload_compressed) {        int rc = 0;        unsigned int size_u = 1 + header->payload_uncompressed;        char *uncompressed = calloc(1, header->payload_offset + size_u);        crm_trace("Decompressing message data %d bytes into %d bytes",                 header->payload_compressed, size_u);        rc = BZ2_bzBuffToBuffDecompress(uncompressed + header->payload_offset, &size_u,                                        remote->buffer + header->payload_offset,                                        header->payload_compressed, 1, 0);        if (rc != BZ_OK && header->version > REMOTE_MSG_VERSION) {            crm_warn("Couldn't decompress v%d message, we only understand v%d",                     header->version, REMOTE_MSG_VERSION);            free(uncompressed);            return NULL;        } else if (rc != BZ_OK) {            crm_err("Decompression failed: %s (%d)", bz2_strerror(rc), rc);            free(uncompressed);            return NULL;        }        CRM_ASSERT(size_u == header->payload_uncompressed);        memcpy(uncompressed, remote->buffer, header->payload_offset);       /* Preserve the header */        remote->buffer_size = header->payload_offset + size_u;        free(remote->buffer);        remote->buffer = uncompressed;        header = crm_remote_header(remote);    }    CRM_LOG_ASSERT(remote->buffer[sizeof(struct crm_remote_header_v0) + header->payload_uncompressed - 1] == 0);    xml = string2xml(remote->buffer + header->payload_offset);    if (xml == NULL && header->version > REMOTE_MSG_VERSION) {        crm_warn("Couldn't parse v%d message, we only understand v%d",                 header->version, REMOTE_MSG_VERSION);    } else if (xml == NULL) {        crm_err("Couldn't parse: '%.120s'", remote->buffer + header->payload_offset);    }    return xml;}
开发者ID:KevenChang,项目名称:pacemaker,代码行数:66,


示例5: operation_finished

static voidoperation_finished(mainloop_child_t * p, pid_t pid, int core, int signo, int exitcode){    svc_action_t *op = mainloop_child_userdata(p);    char *prefix = crm_strdup_printf("%s:%d", op->id, op->pid);    mainloop_clear_child_userdata(p);    op->status = PCMK_LRM_OP_DONE;    CRM_ASSERT(op->pid == pid);    crm_trace("%s %p %p", prefix, op->opaque->stderr_gsource, op->opaque->stdout_gsource);    if (op->opaque->stderr_gsource) {        /* Make sure we have read everything from the buffer.         * Depending on the priority mainloop gives the fd, operation_finished         * could occur before all the reads are done.  Force the read now.*/        crm_trace("%s dispatching stderr", prefix);        dispatch_stderr(op);        crm_trace("%s: %p", op->id, op->stderr_data);        mainloop_del_fd(op->opaque->stderr_gsource);        op->opaque->stderr_gsource = NULL;    }    if (op->opaque->stdout_gsource) {        /* Make sure we have read everything from the buffer.         * Depending on the priority mainloop gives the fd, operation_finished         * could occur before all the reads are done.  Force the read now.*/        crm_trace("%s dispatching stdout", prefix);        dispatch_stdout(op);        crm_trace("%s: %p", op->id, op->stdout_data);        mainloop_del_fd(op->opaque->stdout_gsource);        op->opaque->stdout_gsource = NULL;    }    if (signo) {        if (mainloop_child_timeout(p)) {            crm_warn("%s - timed out after %dms", prefix, op->timeout);            op->status = PCMK_LRM_OP_TIMEOUT;            op->rc = PCMK_OCF_TIMEOUT;        } else {            do_crm_log_unlikely((op->cancel) ? LOG_INFO : LOG_WARNING,                                "%s - terminated with signal %d", prefix, signo);            op->status = PCMK_LRM_OP_ERROR;            op->rc = PCMK_OCF_SIGNAL;        }    } else {        op->rc = exitcode;        crm_debug("%s - exited with rc=%d", prefix, exitcode);    }    free(prefix);    prefix = crm_strdup_printf("%s:%d:stderr", op->id, op->pid);    crm_log_output(LOG_NOTICE, prefix, op->stderr_data);    free(prefix);    prefix = crm_strdup_printf("%s:%d:stdout", op->id, op->pid);    crm_log_output(LOG_DEBUG, prefix, op->stdout_data);    free(prefix);    operation_finalize(op);}
开发者ID:ingted,项目名称:clusterLab,代码行数:62,


示例6: pcmk_message_common_cs

char *pcmk_message_common_cs(cpg_handle_t handle, uint32_t nodeid, uint32_t pid, void *content,                        uint32_t *kind, const char **from){    char *data = NULL;    AIS_Message *msg = (AIS_Message *) content;    if(handle) {        /* 'msg' came from CPG not the plugin         * Do filtering and field massaging         */        uint32_t local_nodeid = get_local_nodeid(handle);        const char *local_name = get_local_node_name();        if (msg->sender.id > 0 && msg->sender.id != nodeid) {            crm_err("Nodeid mismatch from %d.%d: claimed nodeid=%u", nodeid, pid, msg->sender.id);            return NULL;        } else if (msg->host.id != 0 && (local_nodeid != msg->host.id)) {            /* Not for us */            crm_trace("Not for us: %u != %u", msg->host.id, local_nodeid);            return NULL;        } else if (msg->host.size != 0 && safe_str_neq(msg->host.uname, local_name)) {            /* Not for us */            crm_trace("Not for us: %s != %s", msg->host.uname, local_name);            return NULL;        }        msg->sender.id = nodeid;        if (msg->sender.size == 0) {            crm_node_t *peer = crm_get_peer(nodeid, NULL);            if (peer == NULL) {                crm_err("Peer with nodeid=%u is unknown", nodeid);            } else if (peer->uname == NULL) {                crm_err("No uname for peer with nodeid=%u", nodeid);            } else {                crm_notice("Fixing uname for peer with nodeid=%u", nodeid);                msg->sender.size = strlen(peer->uname);                memset(msg->sender.uname, 0, MAX_NAME);                memcpy(msg->sender.uname, peer->uname, msg->sender.size);            }        }    }    crm_trace("Got new%s message (size=%d, %d, %d)",              msg->is_compressed ? " compressed" : "",              ais_data_len(msg), msg->size, msg->compressed_size);    if (kind != NULL) {        *kind = msg->header.id;    }    if (from != NULL) {        *from = msg->sender.uname;    }    if (msg->is_compressed && msg->size > 0) {        int rc = BZ_OK;        char *uncompressed = NULL;        unsigned int new_size = msg->size + 1;        if (check_message_sanity(msg, NULL) == FALSE) {            goto badmsg;        }        crm_trace("Decompressing message data");        uncompressed = calloc(1, new_size);        rc = BZ2_bzBuffToBuffDecompress(uncompressed, &new_size, msg->data, msg->compressed_size, 1, 0);        if (rc != BZ_OK) {            crm_err("Decompression failed: %d", rc);            free(uncompressed);            goto badmsg;        }        CRM_ASSERT(rc == BZ_OK);        CRM_ASSERT(new_size == msg->size);        data = uncompressed;    } else if (check_message_sanity(msg, data) == FALSE) {        goto badmsg;    } else if (safe_str_eq("identify", data)) {        int pid = getpid();        char *pid_s = crm_itoa(pid);        send_cluster_text(crm_class_cluster, pid_s, TRUE, NULL, crm_msg_ais);        free(pid_s);        return NULL;    } else {        data = strdup(msg->data);    }    if (msg->header.id != crm_class_members) {        /* Is this even needed anymore? */        crm_get_peer(msg->sender.id, msg->sender.uname);//.........这里部分代码省略.........
开发者ID:oalbrigt,项目名称:pacemaker,代码行数:101,


示例7: convert_non_atomic_uuid

static char *convert_non_atomic_uuid(char *old_uuid, resource_t * rsc, gboolean allow_notify,                        gboolean free_original){    int interval = 0;    char *uuid = NULL;    char *rid = NULL;    char *raw_task = NULL;    int task = no_action;    CRM_ASSERT(rsc);    pe_rsc_trace(rsc, "Processing %s", old_uuid);    if (old_uuid == NULL) {        return NULL;    } else if (strstr(old_uuid, "notify") != NULL) {        goto done;              /* no conversion */    } else if (rsc->variant < pe_group) {        goto done;              /* no conversion */    }    CRM_ASSERT(parse_op_key(old_uuid, &rid, &raw_task, &interval));    if (interval > 0) {        goto done;              /* no conversion */    }    task = text2task(raw_task);    switch (task) {        case stop_rsc:        case start_rsc:        case action_notify:        case action_promote:        case action_demote:            break;        case stopped_rsc:        case started_rsc:        case action_notified:        case action_promoted:        case action_demoted:            task--;            break;        case monitor_rsc:        case shutdown_crm:        case stonith_node:            task = no_action;            break;        default:            crm_err("Unknown action: %s", raw_task);            task = no_action;            break;    }    if (task != no_action) {        if (is_set(rsc->flags, pe_rsc_notify) && allow_notify) {            uuid = generate_notify_key(rid, "confirmed-post", task2text(task + 1));        } else {            uuid = generate_op_key(rid, task2text(task + 1), 0);        }        pe_rsc_trace(rsc, "Converted %s -> %s", old_uuid, uuid);    }  done:    if (uuid == NULL) {        uuid = strdup(old_uuid);    }    if (free_original) {        free(old_uuid);    }    free(raw_task);    free(rid);    return uuid;}
开发者ID:SynetoNet,项目名称:pacemaker,代码行数:76,


示例8: cib_config_changed

gbooleancib_config_changed(xmlNode * last, xmlNode * next, xmlNode ** diff){    int lpc = 0, max = 0;    gboolean config_changes = FALSE;    xmlXPathObject *xpathObj = NULL;    CRM_ASSERT(diff != NULL);    if (*diff == NULL && last != NULL && next != NULL) {        *diff = diff_xml_object(last, next, FALSE);    }    if (*diff == NULL) {        goto done;    }    xpathObj = xpath_search(*diff, "//" XML_CIB_TAG_CONFIGURATION);    if (numXpathResults(xpathObj) > 0) {        config_changes = TRUE;        goto done;    }    freeXpathObject(xpathObj);    /*     * Do not check XML_TAG_DIFF_ADDED "//" XML_TAG_CIB     * This always contains every field and would produce a false positive     * every time if the checked value existed     */    xpathObj = xpath_search(*diff, "//" XML_TAG_DIFF_REMOVED "//" XML_TAG_CIB);    max = numXpathResults(xpathObj);    for (lpc = 0; lpc < max; lpc++) {        xmlNode *top = getXpathResult(xpathObj, lpc);        if (crm_element_value(top, XML_ATTR_GENERATION) != NULL) {            config_changes = TRUE;            goto done;        }        if (crm_element_value(top, XML_ATTR_GENERATION_ADMIN) != NULL) {            config_changes = TRUE;            goto done;        }        if (crm_element_value(top, XML_ATTR_VALIDATION) != NULL) {            config_changes = TRUE;            goto done;        }        if (crm_element_value(top, XML_ATTR_CRM_VERSION) != NULL) {            config_changes = TRUE;            goto done;        }        if (crm_element_value(top, "remote-clear-port") != NULL) {            config_changes = TRUE;            goto done;        }        if (crm_element_value(top, "remote-tls-port") != NULL) {            config_changes = TRUE;            goto done;        }    }  done:    freeXpathObject(xpathObj);    return config_changes;}
开发者ID:davidvossel,项目名称:pacemaker,代码行数:66,


示例9: do_cib_control

/*	 A_CIB_STOP, A_CIB_START, A_CIB_RESTART,	*/voiddo_cib_control(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){	struct crm_subsystem_s *this_subsys = cib_subsystem;		long long stop_actions = A_CIB_STOP;	long long start_actions = A_CIB_START;	if(action & stop_actions) {		if (fsa_cib_conn->state != cib_disconnected && last_resource_update != 0) {		    crm_info("Waiting for resource update %d to complete", last_resource_update);		    crmd_fsa_stall(NULL);		    return;		}		crm_info("Disconnecting CIB");		clear_bit_inplace(fsa_input_register, R_CIB_CONNECTED);		CRM_ASSERT(fsa_cib_conn != NULL);		fsa_cib_conn->cmds->del_notify_callback(		    fsa_cib_conn, T_CIB_DIFF_NOTIFY, do_cib_updated);		if(fsa_cib_conn->state != cib_disconnected) {			fsa_cib_conn->cmds->set_slave(				fsa_cib_conn, cib_scope_local);			fsa_cib_conn->cmds->signoff(fsa_cib_conn);		}	}	if(action & start_actions) {		int rc = cib_ok;				CRM_ASSERT(fsa_cib_conn != NULL);				if(cur_state == S_STOPPING) {			crm_err("Ignoring request to start %s after shutdown",				this_subsys->name);			return;		}		rc = fsa_cib_conn->cmds->signon(			fsa_cib_conn, CRM_SYSTEM_CRMD, cib_command);		if(rc != cib_ok) {			/* a short wait that usually avoids stalling the FSA */			sleep(1); 			rc = fsa_cib_conn->cmds->signon(				fsa_cib_conn, CRM_SYSTEM_CRMD, cib_command);		}				if(rc != cib_ok){			crm_info("Could not connect to the CIB service: %s", cib_error2string(rc));		} else if(cib_ok != fsa_cib_conn->cmds->set_connection_dnotify(				  fsa_cib_conn, crmd_cib_connection_destroy)) {			crm_err("Could not set dnotify callback");					} else if(cib_ok != fsa_cib_conn->cmds->add_notify_callback(				  fsa_cib_conn, T_CIB_REPLACE_NOTIFY,				  do_cib_replaced)) {			crm_err("Could not set CIB notification callback");		} else if(cib_ok != fsa_cib_conn->cmds->add_notify_callback(			      fsa_cib_conn, T_CIB_DIFF_NOTIFY, do_cib_updated)) {		    crm_err("Could not set CIB notification callback");					} else {			set_bit_inplace(				fsa_input_register, R_CIB_CONNECTED);		}				if(is_set(fsa_input_register, R_CIB_CONNECTED) == FALSE) {						cib_retries++;			crm_warn("Couldn't complete CIB registration %d"				 " times... pause and retry",				 cib_retries);						if(cib_retries < 30) {				crm_timer_start(wait_timer);				crmd_fsa_stall(NULL);							} else {				crm_err("Could not complete CIB"					" registration  %d times..."					" hard error", cib_retries);				register_fsa_error(					C_FSA_INTERNAL, I_ERROR, NULL);			}		} else {			int call_id = 0;						crm_info("CIB connection established");			//.........这里部分代码省略.........
开发者ID:ClusterLabs,项目名称:pacemaker-1.0,代码行数:101,


示例10: master_promotion_order

static voidmaster_promotion_order(resource_t * rsc, pe_working_set_t * data_set){    GListPtr gIter = NULL;    node_t *node = NULL;    node_t *chosen = NULL;    clone_variant_data_t *clone_data = NULL;    get_clone_variant_data(clone_data, rsc);    if (clone_data->merged_master_weights) {        return;    }    clone_data->merged_master_weights = TRUE;    crm_trace("Merging weights for %s", rsc->id);    set_bit(rsc->flags, pe_rsc_merging);    gIter = rsc->children;    for (; gIter != NULL; gIter = gIter->next) {        resource_t *child = (resource_t *) gIter->data;        crm_trace("Sort index: %s = %d", child->id, child->sort_index);    }    dump_node_scores(LOG_DEBUG_3, rsc, "Before", rsc->allowed_nodes);    gIter = rsc->children;    for (; gIter != NULL; gIter = gIter->next) {        resource_t *child = (resource_t *) gIter->data;        chosen = child->fns->location(child, NULL, FALSE);        if (chosen == NULL || child->sort_index < 0) {            crm_trace("Skipping %s", child->id);            continue;        }        node = (node_t *) pe_hash_table_lookup(rsc->allowed_nodes, chosen->details->id);        CRM_ASSERT(node != NULL);        /* adds in master preferences and rsc_location.role=Master */        crm_trace("Adding %s to %s from %s", score2char(child->sort_index), node->details->uname,                  child->id);        node->weight = merge_weights(child->sort_index, node->weight);    }    dump_node_scores(LOG_DEBUG_3, rsc, "Middle", rsc->allowed_nodes);    gIter = rsc->rsc_cons;    for (; gIter != NULL; gIter = gIter->next) {        rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data;        /* (re-)adds location preferences of resources that the         * master instance should/must be colocated with         */        if (constraint->role_lh == RSC_ROLE_MASTER) {            crm_trace("RHS: %s with %s: %d", constraint->rsc_lh->id, constraint->rsc_rh->id,                        constraint->score);            rsc->allowed_nodes =                constraint->rsc_rh->cmds->merge_weights(constraint->rsc_rh, rsc->id,                                                        rsc->allowed_nodes,                                                        constraint->node_attribute,                                                        constraint->score / INFINITY,                                                        constraint->score ==                                                        INFINITY ? FALSE : TRUE, FALSE);        }    }    gIter = rsc->rsc_cons_lhs;    for (; gIter != NULL; gIter = gIter->next) {        rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data;        /* (re-)adds location preferences of resource that wish to be         * colocated with the master instance         */        if (constraint->role_rh == RSC_ROLE_MASTER) {            crm_trace("LHS: %s with %s: %d", constraint->rsc_lh->id, constraint->rsc_rh->id,                        constraint->score);            rsc->allowed_nodes =                constraint->rsc_lh->cmds->merge_weights(constraint->rsc_lh, rsc->id,                                                        rsc->allowed_nodes,                                                        constraint->node_attribute,                                                        constraint->score / INFINITY, TRUE, TRUE);        }    }    gIter = rsc->rsc_tickets;    for (; gIter != NULL; gIter = gIter->next) {        rsc_ticket_t *rsc_ticket = (rsc_ticket_t *) gIter->data;        if (rsc_ticket->role_lh == RSC_ROLE_MASTER && rsc_ticket->ticket->granted == FALSE) {            resource_location(rsc, NULL, -INFINITY, "__stateful_without_ticket__", data_set);        }    }    dump_node_scores(LOG_DEBUG_3, rsc, "After", rsc->allowed_nodes);    /* write them back and sort */    gIter = rsc->children;    for (; gIter != NULL; gIter = gIter->next) {        resource_t *child = (resource_t *) gIter->data;//.........这里部分代码省略.........
开发者ID:smellman,项目名称:pacemaker,代码行数:101,


示例11: te_fence_node

static gbooleante_fence_node(crm_graph_t *graph, crm_action_t *action){	const char *id = NULL;	const char *uuid = NULL;	const char *target = NULL;	const char *type = NULL;	stonith_ops_t * st_op = NULL;		id = ID(action->xml);	target = crm_element_value(action->xml, XML_LRM_ATTR_TARGET);	uuid = crm_element_value(action->xml, XML_LRM_ATTR_TARGET_UUID);	type = crm_meta_value(action->params, "stonith_action");		CRM_CHECK(id != NULL,		  crm_log_xml_warn(action->xml, "BadAction");		  return FALSE);	CRM_CHECK(uuid != NULL,		  crm_log_xml_warn(action->xml, "BadAction");		  return FALSE);	CRM_CHECK(type != NULL,		  crm_log_xml_warn(action->xml, "BadAction");		  return FALSE);	CRM_CHECK(target != NULL,		  crm_log_xml_warn(action->xml, "BadAction");		  return FALSE);	te_log_action(LOG_INFO,		      "Executing %s fencing operation (%s) on %s (timeout=%d)",		      type, id, target, transition_graph->stonith_timeout);	/* Passing NULL means block until we can connect... */	te_connect_stonith(NULL);		crm_malloc0(st_op, sizeof(stonith_ops_t));	if(safe_str_eq(type, "poweroff")) {		st_op->optype = POWEROFF;	} else {		st_op->optype = RESET;	}		st_op->timeout = transition_graph->stonith_timeout;	st_op->node_name = crm_strdup(target);	st_op->node_uuid = crm_strdup(uuid);		st_op->private_data = generate_transition_key(	    transition_graph->id, action->id, 0, te_uuid);		CRM_ASSERT(stonithd_input_IPC_channel() != NULL);			if (ST_OK != stonithd_node_fence( st_op )) {		crm_err("Cannot fence %s: stonithd_node_fence() call failed ",			target);	}	crm_free(st_op->node_name);	crm_free(st_op->node_uuid);	crm_free(st_op->private_data);	crm_free(st_op);	return TRUE;}
开发者ID:HideoYamauchi,项目名称:Comment-Pacemaker1-0-12,代码行数:61,


示例12: do_election_count_vote

/*	A_ELECTION_COUNT	*/voiddo_election_count_vote(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){    struct timeval your_age;    int age;    int election_id = -1;    int log_level = LOG_INFO;    gboolean use_born_on = FALSE;    gboolean done = FALSE;    gboolean we_loose = FALSE;    const char *op = NULL;    const char *vote_from = NULL;    const char *your_version = NULL;    const char *election_owner = NULL;    const char *reason = "unknown";    crm_node_t *our_node = NULL, *your_node = NULL;    ha_msg_input_t *vote = fsa_typed_data(fsa_dt_ha_msg);    static time_t last_election_loss = 0;    /* if the membership copy is NULL we REALLY shouldnt be voting     * the question is how we managed to get here.     */    CRM_CHECK(msg_data != NULL, return);    CRM_CHECK(crm_peer_cache != NULL, return);    CRM_CHECK(vote != NULL, crm_err("Bogus data from %s", msg_data->origin); return);    CRM_CHECK(vote->msg != NULL, crm_err("Bogus data from %s", msg_data->origin); return);    your_age.tv_sec = 0;    your_age.tv_usec = 0;    op = crm_element_value(vote->msg, F_CRM_TASK);    vote_from = crm_element_value(vote->msg, F_CRM_HOST_FROM);    your_version = crm_element_value(vote->msg, F_CRM_VERSION);    election_owner = crm_element_value(vote->msg, F_CRM_ELECTION_OWNER);    crm_element_value_int(vote->msg, F_CRM_ELECTION_ID, &election_id);    crm_element_value_int(vote->msg, F_CRM_ELECTION_AGE_S, (int *)&(your_age.tv_sec));    crm_element_value_int(vote->msg, F_CRM_ELECTION_AGE_US, (int *)&(your_age.tv_usec));    CRM_CHECK(vote_from != NULL, vote_from = fsa_our_uname);    your_node = crm_get_peer(0, vote_from);    our_node = crm_get_peer(0, fsa_our_uname);    if (voted == NULL) {        crm_debug("Created voted hash");        voted = g_hash_table_new_full(crm_str_hash, g_str_equal,                                      g_hash_destroy_str, g_hash_destroy_str);    }    if (is_heartbeat_cluster()) {        use_born_on = TRUE;    } else if (is_classic_ais_cluster()) {        use_born_on = TRUE;    }    age = crm_compare_age(your_age);    if (cur_state == S_STARTING) {        reason = "Still starting";        we_loose = TRUE;    } else if (our_node == NULL || crm_is_peer_active(our_node) == FALSE) {        reason = "We are not part of the cluster";        log_level = LOG_ERR;        we_loose = TRUE;    } else if (election_id != current_election_id && crm_str_eq(fsa_our_uuid, election_owner, TRUE)) {        log_level = LOG_DEBUG_2;        reason = "Superceeded";        done = TRUE;    } else if (your_node == NULL || crm_is_peer_active(your_node) == FALSE) {        /* Possibly we cached the message in the FSA queue at a point that it wasn't */        reason = "Peer is not part of our cluster";        log_level = LOG_WARNING;        done = TRUE;    } else if (crm_str_eq(op, CRM_OP_NOVOTE, TRUE)) {        char *op_copy = strdup(op);        char *uname_copy = strdup(vote_from);        CRM_ASSERT(crm_str_eq(fsa_our_uuid, election_owner, TRUE));        /* update the list of nodes that have voted */        g_hash_table_replace(voted, uname_copy, op_copy);        reason = "Recorded";        done = TRUE;    } else if (crm_str_eq(vote_from, fsa_our_uname, TRUE)) {        char *op_copy = strdup(op);        char *uname_copy = strdup(vote_from);        CRM_ASSERT(crm_str_eq(fsa_our_uuid, election_owner, TRUE));//.........这里部分代码省略.........
开发者ID:jnewland,项目名称:pacemaker,代码行数:101,


示例13: election_count_vote

/*	A_ELECTION_COUNT	*/enum election_resultelection_count_vote(election_t *e, xmlNode *vote, bool can_win){    int age = 0;    int election_id = -1;    int log_level = LOG_INFO;    gboolean use_born_on = FALSE;    gboolean done = FALSE;    gboolean we_loose = FALSE;    const char *op = NULL;    const char *from = NULL;    const char *reason = "unknown";    const char *election_owner = NULL;    crm_node_t *our_node = NULL, *your_node = NULL;    static int election_wins = 0;    xmlNode *novote = NULL;    time_t tm_now = time(NULL);    static time_t expires = 0;    static time_t last_election_loss = 0;    /* if the membership copy is NULL we REALLY shouldn't be voting     * the question is how we managed to get here.     */    CRM_CHECK(vote != NULL, return election_error);    if(e == NULL) {        crm_info("Not voting in election: not initialized");        return election_lost;    } else if(crm_peer_cache == NULL) {        crm_info("Not voting in election: no peer cache");        return election_lost;    }    op = crm_element_value(vote, F_CRM_TASK);    from = crm_element_value(vote, F_CRM_HOST_FROM);    election_owner = crm_element_value(vote, F_CRM_ELECTION_OWNER);    crm_element_value_int(vote, F_CRM_ELECTION_ID, &election_id);    your_node = crm_get_peer(0, from);    our_node = crm_get_peer(0, e->uname);    if (e->voted == NULL) {        crm_debug("Created voted hash");        e->voted = g_hash_table_new_full(crm_str_hash, g_str_equal,                                         g_hash_destroy_str, g_hash_destroy_str);    }    if (is_heartbeat_cluster()) {        use_born_on = TRUE;    } else if (is_classic_ais_cluster()) {        use_born_on = TRUE;    }    if(can_win == FALSE) {        reason = "Not eligible";        we_loose = TRUE;    } else if (our_node == NULL || crm_is_peer_active(our_node) == FALSE) {        reason = "We are not part of the cluster";        log_level = LOG_ERR;        we_loose = TRUE;    } else if (election_id != e->count && crm_str_eq(our_node->uuid, election_owner, TRUE)) {        log_level = LOG_TRACE;        reason = "Superseded";        done = TRUE;    } else if (your_node == NULL || crm_is_peer_active(your_node) == FALSE) {        /* Possibly we cached the message in the FSA queue at a point that it wasn't */        reason = "Peer is not part of our cluster";        log_level = LOG_WARNING;        done = TRUE;    } else if (crm_str_eq(op, CRM_OP_NOVOTE, TRUE)) {        char *op_copy = strdup(op);        char *uname_copy = strdup(from);        CRM_ASSERT(crm_str_eq(our_node->uuid, election_owner, TRUE));        /* update the list of nodes that have voted */        g_hash_table_replace(e->voted, uname_copy, op_copy);        reason = "Recorded";        done = TRUE;    } else {        struct timeval your_age;        const char *your_version = crm_element_value(vote, F_CRM_VERSION);        int tv_sec = 0;        int tv_usec = 0;        crm_element_value_int(vote, F_CRM_ELECTION_AGE_S, &tv_sec);        crm_element_value_int(vote, F_CRM_ELECTION_AGE_US, &tv_usec);        your_age.tv_sec = tv_sec;        your_age.tv_usec = tv_usec;//.........这里部分代码省略.........
开发者ID:HideoYamauchi,项目名称:pacemaker-Pacemaker-1.1.14-comment,代码行数:101,


示例14: crm_ipc_name

const char *crm_ipc_name(crm_ipc_t * client){    CRM_ASSERT(client != NULL);    return client->name;}
开发者ID:credativ,项目名称:pacemaker,代码行数:6,


示例15: 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);    const char *op = NULL;    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;    }    op = crm_element_value(request, F_CRM_TASK);    if(safe_str_eq(op, CRM_OP_RM_NODE_CACHE)) {        crm_xml_add(request, F_TYPE, T_STONITH_NG);        crm_xml_add(request, F_STONITH_OPERATION, op);        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);        send_cluster_message(NULL, crm_msg_stonith_ng, request, FALSE);        free_xml(request);        return 0;    }    if (c->name == NULL) {        const char *value = crm_element_value(request, F_STONITH_CLIENTNAME);        if (value == NULL) {            value = "unknown";        }        c->name = crm_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:dpejesh,项目名称:pacemaker,代码行数:64,


示例16: crm_ipc_prepare

ssize_tcrm_ipc_prepare(uint32_t request, xmlNode * message, struct iovec ** result, uint32_t max_send_size){    static unsigned int biggest = 0;    struct iovec *iov;    unsigned int total = 0;    char *compressed = NULL;    char *buffer = dump_xml_unformatted(message);    struct crm_ipc_response_header *header = calloc(1, sizeof(struct crm_ipc_response_header));    CRM_ASSERT(result != NULL);    crm_ipc_init();    if (max_send_size == 0) {        max_send_size = ipc_buffer_max;    }    CRM_LOG_ASSERT(max_send_size != 0);    *result = NULL;    iov = calloc(2, sizeof(struct iovec));    iov[0].iov_len = hdr_offset;    iov[0].iov_base = header;    header->version = PCMK_IPC_VERSION;    header->size_uncompressed = 1 + strlen(buffer);    total = iov[0].iov_len + header->size_uncompressed;    if (total < max_send_size) {        iov[1].iov_base = buffer;        iov[1].iov_len = header->size_uncompressed;    } else {        unsigned int new_size = 0;        if (crm_compress_string            (buffer, header->size_uncompressed, max_send_size, &compressed, &new_size)) {            header->flags |= crm_ipc_compressed;            header->size_compressed = new_size;            iov[1].iov_len = header->size_compressed;            iov[1].iov_base = compressed;            free(buffer);            biggest = QB_MAX(header->size_compressed, biggest);        } else {            ssize_t rc = -EMSGSIZE;            crm_log_xml_trace(message, "EMSGSIZE");            biggest = QB_MAX(header->size_uncompressed, biggest);            crm_err                ("Could not compress the message (%u bytes) into less than the configured ipc limit (%u bytes). "                 "Set PCMK_ipc_buffer to a higher value (%u bytes suggested)",                 header->size_uncompressed, max_send_size, 4 * biggest);            free(compressed);            free(buffer);            free(header);            free(iov);            return rc;        }    }    header->qb.size = iov[0].iov_len + iov[1].iov_len;    header->qb.id = (int32_t)request;    /* Replying to a specific request */    *result = iov;    CRM_ASSERT(header->qb.size > 0);    return header->qb.size;}
开发者ID:credativ,项目名称:pacemaker,代码行数:78,


示例17: crm_get_peer

/* coverity[-alloc] Memory is referenced in one or both hashtables */crm_node_t *crm_get_peer(unsigned int id, const char *uname){    crm_node_t *node = NULL;    CRM_ASSERT(id > 0 || uname != NULL);    crm_peer_init();    if (node == NULL && uname != NULL) {        node = g_hash_table_lookup(crm_peer_cache, uname);    }    if (node == NULL && id > 0) {        node = g_hash_table_lookup(crm_peer_id_cache, GUINT_TO_POINTER(id));        if (node && node->uname && uname) {            crm_crit("Node %s and %s share the same cluster node id '%u'!", node->uname, uname, id);                        /* NOTE: Calling crm_new_peer() means the entry in              * crm_peer_id_cache will point to the new entity             *             * TO-DO: Replace the old uname instead?             */            node = NULL;        }    }    if (node == NULL) {        crm_debug("Creating entry for node %s/%u", uname, id);        node = calloc(1, sizeof(crm_node_t));        CRM_ASSERT(node);    }    if (id > 0 && node->id != id) {        node->id = id;        crm_info("Node %s now has id: %u", crm_str(uname), id);        g_hash_table_replace(crm_peer_id_cache, GUINT_TO_POINTER(node->id), node);    }    if (uname && node->uname == NULL) {        node->uname = strdup(uname);        crm_info("Node %u is now known as %s", id, uname);        g_hash_table_replace(crm_peer_cache, node->uname, node);        if (crm_status_callback) {            crm_status_callback(crm_status_uname, node, NULL);        }    }    if (node && node->uname && node->uuid == NULL) {        const char *uuid = get_node_uuid(id, node->uname);        if(uuid) {            node->uuid = strdup(uuid);            crm_info("Node %u has uuid %s", id, node->uuid);        } else {            crm_warn("Cannot obtain a UUID for node %d/%s", id, node->uname);        }    }    return node;}
开发者ID:bcavanagh,项目名称:pacemaker,代码行数:63,


示例18: action_synced_wait

static voidaction_synced_wait(svc_action_t * op, sigset_t mask){#ifndef HAVE_SYS_SIGNALFD_H    CRM_ASSERT(FALSE);#else    int status = 0;    int timeout = op->timeout;    int sfd = -1;    time_t start = -1;    struct pollfd fds[3];    int wait_rc = 0;    sfd = signalfd(-1, &mask, SFD_NONBLOCK);    if (sfd < 0) {        crm_perror(LOG_ERR, "signalfd() failed");    }    fds[0].fd = op->opaque->stdout_fd;    fds[0].events = POLLIN;    fds[0].revents = 0;    fds[1].fd = op->opaque->stderr_fd;    fds[1].events = POLLIN;    fds[1].revents = 0;    fds[2].fd = sfd;    fds[2].events = POLLIN;    fds[2].revents = 0;    crm_trace("Waiting for %d", op->pid);    start = time(NULL);    do {        int poll_rc = poll(fds, 3, timeout);        if (poll_rc > 0) {            if (fds[0].revents & POLLIN) {                svc_read_output(op->opaque->stdout_fd, op, FALSE);            }            if (fds[1].revents & POLLIN) {                svc_read_output(op->opaque->stderr_fd, op, TRUE);            }            if (fds[2].revents & POLLIN) {                struct signalfd_siginfo fdsi;                ssize_t s;                s = read(sfd, &fdsi, sizeof(struct signalfd_siginfo));                if (s != sizeof(struct signalfd_siginfo)) {                    crm_perror(LOG_ERR, "Read from signal fd %d failed", sfd);                } else if (fdsi.ssi_signo == SIGCHLD) {                    wait_rc = waitpid(op->pid, &status, WNOHANG);                    if (wait_rc < 0){                        crm_perror(LOG_ERR, "waitpid() for %d failed", op->pid);                    } else if (wait_rc > 0) {                        break;                    }                }            }        } else if (poll_rc == 0) {            timeout = 0;            break;        } else if (poll_rc < 0) {            if (errno != EINTR) {                crm_perror(LOG_ERR, "poll() failed");                break;            }        }        timeout = op->timeout - (time(NULL) - start) * 1000;    } while ((op->timeout < 0 || timeout > 0));    crm_trace("Child done: %d", op->pid);    if (wait_rc <= 0) {        int killrc = kill(op->pid, SIGKILL);        op->rc = PCMK_OCF_UNKNOWN_ERROR;        if (op->timeout > 0 && timeout <= 0) {            op->status = PCMK_LRM_OP_TIMEOUT;            crm_warn("%s:%d - timed out after %dms", op->id, op->pid, op->timeout);        } else {            op->status = PCMK_LRM_OP_ERROR;        }        if (killrc && errno != ESRCH) {            crm_err("kill(%d, KILL) failed: %d", op->pid, errno);        }        /*         * From sigprocmask(2):         * It is not possible to block SIGKILL or SIGSTOP.  Attempts to do so are silently ignored.         *//.........这里部分代码省略.........
开发者ID:ingted,项目名称:clusterLab,代码行数:101,


示例19: construct_pam_passwd

/*  * Useful Examples: *    http://www.kernel.org/pub/linux/libs/pam/Linux-PAM-html *    http://developer.apple.com/samplecode/CryptNoMore/index.html */static intconstruct_pam_passwd(int num_msg, const struct pam_message **msg,                     struct pam_response **response, void *data){    int count = 0;    struct pam_response *reply;    char *string = (char *)data;    CRM_CHECK(data, return PAM_CONV_ERR);    CRM_CHECK(num_msg == 1, return PAM_CONV_ERR);       /* We only want to handle one message */    reply = calloc(1, sizeof(struct pam_response));    CRM_ASSERT(reply != NULL);    for (count = 0; count < num_msg; ++count) {        switch (msg[count]->msg_style) {            case PAM_TEXT_INFO:                crm_info("PAM: %s/n", msg[count]->msg);                break;            case PAM_PROMPT_ECHO_OFF:            case PAM_PROMPT_ECHO_ON:                reply[count].resp_retcode = 0;                reply[count].resp = string;     /* We already made a copy */            case PAM_ERROR_MSG:                /* In theory we'd want to print this, but then                 * we see the password prompt in the logs                 */                /* crm_err("PAM error: %s/n", msg[count]->msg); */                break;            default:                crm_err("Unhandled conversation type: %d", msg[count]->msg_style);                goto bail;        }    }    *response = reply;    reply = NULL;    return PAM_SUCCESS;  bail:    for (count = 0; count < num_msg; ++count) {        if (reply[count].resp != NULL) {            switch (msg[count]->msg_style) {                case PAM_PROMPT_ECHO_ON:                case PAM_PROMPT_ECHO_OFF:                    /* Erase the data - it contained a password */                    while (*(reply[count].resp)) {                        *(reply[count].resp)++ = '/0';                    }                    free(reply[count].resp);                    break;            }            reply[count].resp = NULL;        }    }    free(reply);    reply = NULL;    return PAM_CONV_ERR;}
开发者ID:fghaas,项目名称:pacemaker,代码行数:66,


示例20: crm_is_writable

/*! * /internal * /brief Return whether a directory or file is writable by a user/group * * /param[in] dir Directory to check or that contains file * /param[in] file File name to check (or NULL to check directory) * /param[in] user Name of user that should have write permission * /param[in] group Name of group that should have write permission * /param[in] need_both Whether both user and group must be able to write * * /return TRUE if permissions match, FALSE if they don't or on error */gbooleancrm_is_writable(const char *dir, const char *file,                const char *user, const char *group, gboolean need_both){    int s_res = -1;    struct stat buf;    char *full_file = NULL;    const char *target = NULL;    gboolean pass = TRUE;    gboolean readwritable = FALSE;    CRM_ASSERT(dir != NULL);    if (file != NULL) {        full_file = crm_concat(dir, file, '/');        target = full_file;        s_res = stat(full_file, &buf);        if (s_res == 0 && S_ISREG(buf.st_mode) == FALSE) {            crm_err("%s must be a regular file", target);            pass = FALSE;            goto out;        }    }    if (s_res != 0) {        target = dir;        s_res = stat(dir, &buf);        if (s_res != 0) {            crm_err("%s must exist and be a directory", dir);            pass = FALSE;            goto out;        } else if (S_ISDIR(buf.st_mode) == FALSE) {            crm_err("%s must be a directory", dir);            pass = FALSE;        }    }    if (user) {        struct passwd *sys_user = NULL;        sys_user = getpwnam(user);        readwritable = (sys_user != NULL                        && buf.st_uid == sys_user->pw_uid && (buf.st_mode & (S_IRUSR | S_IWUSR)));        if (readwritable == FALSE) {            crm_err("%s must be owned and r/w by user %s", target, user);            if (need_both) {                pass = FALSE;            }        }    }    if (group) {        struct group *sys_grp = getgrnam(group);        readwritable = (sys_grp != NULL                        && buf.st_gid == sys_grp->gr_gid && (buf.st_mode & (S_IRGRP | S_IWGRP)));        if (readwritable == FALSE) {            if (need_both || user == NULL) {                pass = FALSE;                crm_err("%s must be owned and r/w by group %s", target, group);            } else {                crm_warn("%s should be owned and r/w by group %s", target, group);            }        }    }  out:    free(full_file);    return pass;}
开发者ID:KevenChang,项目名称:pacemaker,代码行数:83,


示例21: crm_get_peer

/* coverity[-alloc] Memory is referenced in one or both hashtables */crm_node_t *crm_get_peer(unsigned int id, const char *uname){    GHashTableIter iter;    crm_node_t *node = NULL;    crm_node_t *by_id = NULL;    crm_node_t *by_name = NULL;    CRM_ASSERT(id > 0 || uname != NULL);    crm_peer_init();    if (uname != NULL) {        g_hash_table_iter_init(&iter, crm_peer_cache);        while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &node)) {            if(node->uname && strcasecmp(node->uname, uname) == 0) {                crm_trace("Name match: %s = %p", node->uname, node);                by_name = node;                break;            }        }    }    if (id > 0) {        g_hash_table_iter_init(&iter, crm_peer_cache);        while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &node)) {            if(node->id == id) {                crm_trace("ID match: %u = %p", node->id, node);                by_id = node;                break;            }        }    }    node = by_id; /* Good default */    if(by_id == by_name) {        /* Nothing to do if they match (both NULL counts) */        crm_trace("Consistent: %p for %u/%s", by_id, id, uname);    } else if(by_id == NULL && by_name) {        crm_trace("Only one: %p for %u/%s", by_name, id, uname);        if(id && by_name->id) {            crm_dump_peer_hash(LOG_WARNING, __FUNCTION__);            crm_crit("Node %u and %u share the same name '%s'",                     id, by_name->id, uname);            node = NULL; /* Create a new one */        } else {            node = by_name;        }    } else if(by_name == NULL && by_id) {        crm_trace("Only one: %p for %u/%s", by_id, id, uname);        if(uname && by_id->uname) {            crm_dump_peer_hash(LOG_WARNING, __FUNCTION__);            crm_crit("Node '%s' and '%s' share the same cluster nodeid %u: assuming '%s' is correct",                     uname, by_id->uname, id, uname);        }    } else if(uname && by_id->uname) {        crm_warn("Node '%s' and '%s' share the same cluster nodeid: %u", by_id->uname, by_name->uname, id);    } else if(id && by_name->id) {        crm_warn("Node %u and %u share the same name: '%s'", by_id->id, by_name->id, uname);    } else {        /* Simple merge */        /* Only corosync based clusters use nodeid's         *         * The functions that call crm_update_peer_state() only know nodeid         * so 'by_id' is authorative when merging         *         * Same for crm_update_peer_proc()         */        crm_dump_peer_hash(LOG_DEBUG, __FUNCTION__);        crm_info("Merging %p into %p", by_name, by_id);        g_hash_table_foreach_remove(crm_peer_cache, crm_hash_find_by_data, by_name);    }    if (node == NULL) {        char *uniqueid = crm_generate_uuid();        node = calloc(1, sizeof(crm_node_t));        CRM_ASSERT(node);        crm_info("Created entry %s/%p for node %s/%u (%d total)",                 uniqueid, node, uname, id, 1 + g_hash_table_size(crm_peer_cache));        g_hash_table_replace(crm_peer_cache, uniqueid, node);    }    if(id > 0 && uname && (node->id == 0 || node->uname == NULL)) {        crm_info("Node %u is now known as %s", id, uname);    }    if(id > 0 && node->id == 0) {//.........这里部分代码省略.........
开发者ID:vishnumitraha,项目名称:pacemaker,代码行数:101,


示例22: upstart_job_exec

/* For a synchronous 'op', returns FALSE if 'op' fails */gbooleanupstart_job_exec(svc_action_t * op, gboolean synchronous){    char *job = NULL;    int arg_wait = TRUE;    const char *arg_env = "pacemaker=1";    const char *action = op->action;    DBusError error;    DBusMessage *msg = NULL;    DBusMessage *reply = NULL;    DBusMessageIter iter, array_iter;    op->rc = PCMK_OCF_UNKNOWN_ERROR;    CRM_ASSERT(upstart_init());    if (safe_str_eq(op->action, "meta-data")) {        op->stdout_data = upstart_job_metadata(op->agent);        op->rc = PCMK_OCF_OK;        goto cleanup;    }    if(!upstart_job_by_name(op->agent, &job, op->timeout)) {        crm_debug("Could not obtain job named '%s' to %s", op->agent, action);        if (!g_strcmp0(action, "stop")) {            op->rc = PCMK_OCF_OK;        } else {            op->rc = PCMK_OCF_NOT_INSTALLED;            op->status = PCMK_LRM_OP_NOT_INSTALLED;        }        goto cleanup;    }    if (safe_str_eq(op->action, "monitor") || safe_str_eq(action, "status")) {        char *path = get_first_instance(job, op->timeout);        op->rc = PCMK_OCF_NOT_RUNNING;        if(path) {            DBusPendingCall *pending = NULL;            char *state = pcmk_dbus_get_property(                upstart_proxy, BUS_NAME, path, UPSTART_06_API ".Instance", "state",                op->synchronous?NULL:upstart_job_check, op,                op->synchronous?NULL:&pending, op->timeout);            free(job);            free(path);            if(op->synchronous) {                upstart_job_check("state", state, op);                free(state);                return op->rc == PCMK_OCF_OK;            } else if (pending) {                services_set_op_pending(op, pending);                services_add_inflight_op(op);                return TRUE;            }            return FALSE;        }        goto cleanup;    } else if (!g_strcmp0(action, "start")) {        action = "Start";    } else if (!g_strcmp0(action, "stop")) {        action = "Stop";    } else if (!g_strcmp0(action, "restart")) {        action = "Restart";    } else {        op->rc = PCMK_OCF_UNIMPLEMENT_FEATURE;        goto cleanup;    }    crm_debug("Calling %s for %s on %s", action, op->rsc, job);    msg = dbus_message_new_method_call(BUS_NAME, // target for the method call                                       job, // object to call on                                       UPSTART_JOB_IFACE, // interface to call on                                       action); // method name    CRM_ASSERT(msg != NULL);    dbus_message_iter_init_append (msg, &iter);    CRM_LOG_ASSERT(dbus_message_iter_open_container (&iter,                                                     DBUS_TYPE_ARRAY,                                                     DBUS_TYPE_STRING_AS_STRING,                                                     &array_iter));    CRM_LOG_ASSERT(dbus_message_iter_append_basic (&array_iter, DBUS_TYPE_STRING, &arg_env));    CRM_LOG_ASSERT(dbus_message_iter_close_container (&iter, &array_iter));    CRM_LOG_ASSERT(dbus_message_append_args(msg, DBUS_TYPE_BOOLEAN, &arg_wait, DBUS_TYPE_INVALID));    if (op->synchronous == FALSE) {        DBusPendingCall* pending = pcmk_dbus_send(msg, upstart_proxy, upstart_async_dispatch, op, op->timeout);        free(job);        if(pending) {            services_set_op_pending(op, pending);//.........这里部分代码省略.........
开发者ID:beess,项目名称:pacemaker,代码行数:101,


示例23: crm_update_peer

crm_node_t *crm_update_peer(const char *source, unsigned int id, uint64_t born, uint64_t seen, int32_t votes,                uint32_t children, const char *uuid, const char *uname, const char *addr,                const char *state){#if SUPPORT_PLUGIN    gboolean addr_changed = FALSE;    gboolean votes_changed = FALSE;#endif    crm_node_t *node = NULL;    id = get_corosync_id(id, uuid);    node = crm_get_peer(id, uname);    CRM_ASSERT(node != NULL);    if (node->uuid == NULL) {        if (is_openais_cluster()) {            /* Yes, overrule whatever was passed in */            crm_peer_uuid(node);        } else if (uuid != NULL) {            node->uuid = strdup(uuid);        }    }    if (children > 0) {        crm_update_peer_proc(source, node, children, state);    }    if (state != NULL) {        crm_update_peer_state(source, node, state, seen);    }#if SUPPORT_HEARTBEAT    if (born != 0) {        node->born = born;    }#endif#if SUPPORT_PLUGIN    /* These were only used by the plugin */    if (born != 0) {        node->born = born;    }    if (votes > 0 && node->votes != votes) {        votes_changed = TRUE;        node->votes = votes;    }    if (addr != NULL) {        if (node->addr == NULL || crm_str_eq(node->addr, addr, FALSE) == FALSE) {            addr_changed = TRUE;            free(node->addr);            node->addr = strdup(addr);        }    }    if (addr_changed || votes_changed) {        crm_info("%s: Node %s: id=%u state=%s addr=%s%s votes=%d%s born=" U64T " seen=" U64T                 " proc=%.32x", source, node->uname, node->id, node->state,                 node->addr, addr_changed ? " (new)" : "", node->votes,                 votes_changed ? " (new)" : "", node->born, node->last_seen, node->processes);    }#endif    return node;}
开发者ID:vishnumitraha,项目名称:pacemaker,代码行数:67,


示例24: crm_remote_ready

/*! * /internal * /brief Determine if a remote session has data to read * * /retval 0, timeout occured. * /retval positive, data is ready to be read * /retval negative, session has ended */intcrm_remote_ready(crm_remote_t * remote, int timeout /* ms */ ){    struct pollfd fds = { 0, };    int sock = 0;    int rc = 0;    time_t start;#ifdef HAVE_GNUTLS_GNUTLS_H    if (remote->tls_session) {        void *sock_ptr = gnutls_transport_get_ptr(*remote->tls_session);        sock = GPOINTER_TO_INT(sock_ptr);    } else if (remote->tcp_socket) {#else    if (remote->tcp_socket) {#endif        sock = remote->tcp_socket;    } else {        crm_err("Unsupported connection type");    }    if (sock <= 0) {        crm_trace("No longer connected");        return -ENOTCONN;    }    start = time(NULL);    errno = 0;    do {        fds.fd = sock;        fds.events = POLLIN;        /* If we got an EINTR while polling, and we have a         * specific timeout we are trying to honor, attempt         * to adjust the timeout to the closest second. */        if (errno == EINTR && (timeout > 0)) {            timeout = timeout - ((time(NULL) - start) * 1000);            if (timeout < 1000) {                timeout = 1000;            }        }        rc = poll(&fds, 1, timeout);    } while (rc < 0 && errno == EINTR);    return rc;}/*! * /internal * /brief Read bytes off non blocking remote connection. * * /note only use with NON-Blocking sockets. Should only be used after polling socket. *       This function will return once max_size is met, the socket read buffer *       is empty, or an error is encountered. * * /retval number of bytes received */static size_tcrm_remote_recv_once(crm_remote_t * remote){    int rc = 0;    size_t read_len = sizeof(struct crm_remote_header_v0);    struct crm_remote_header_v0 *header = crm_remote_header(remote);    if(header) {        /* Stop at the end of the current message */        read_len = header->size_total;    }    /* automatically grow the buffer when needed */    if(remote->buffer_size < read_len) {           remote->buffer_size = 2 * read_len;        crm_trace("Expanding buffer to %u bytes", remote->buffer_size);        remote->buffer = realloc_safe(remote->buffer, remote->buffer_size + 1);        CRM_ASSERT(remote->buffer != NULL);    }#ifdef HAVE_GNUTLS_GNUTLS_H    if (remote->tls_session) {        rc = gnutls_record_recv(*(remote->tls_session),                                remote->buffer + remote->buffer_offset,                                remote->buffer_size - remote->buffer_offset);        if (rc == GNUTLS_E_INTERRUPTED) {            rc = -EINTR;        } else if (rc == GNUTLS_E_AGAIN) {            rc = -EAGAIN;        } else if (rc < 0) {            crm_debug("TLS receive failed: %s (%d)", gnutls_strerror(rc), rc);//.........这里部分代码省略.........
开发者ID:KevenChang,项目名称:pacemaker,代码行数:101,


示例25: 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);    offset += snprintf(xpath_string + offset, xpath_max - offset, "%.128s", get_object_path(section));    if (safe_str_eq(node_type, XML_CIB_TAG_TICKETS)) {        offset += snprintf(xpath_string + offset, xpath_max - offset, "//%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;        }        offset +=            snprintf(xpath_string + offset, xpath_max - offset, "//%s[@id='%s']", node_type,                     node_uuid);    }    if (set_name) {        offset +=            snprintf(xpath_string + offset, xpath_max - offset, "//%s[@id='%.128s']", set_type,                     set_name);    } else {        offset += snprintf(xpath_string + offset, xpath_max - offset, "//%s", set_type);    }    offset += snprintf(xpath_string + offset, xpath_max - offset, "//nvpair[");    if (attr_id) {        offset += snprintf(xpath_string + offset, xpath_max - offset, "@id='%s'", attr_id);    }    if (attr_name) {        if (attr_id) {            offset += snprintf(xpath_string + offset, xpath_max - offset, " and ");        }        offset += snprintf(xpath_string + offset, xpath_max - offset, "@name='%.128s'", attr_name);    }    offset += snprintf(xpath_string + offset, xpath_max - offset, "]");    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;        attr_msg(LOG_WARNING, "Multiple attributes match name=%s", attr_name);        for (child = __xml_first_child(xml_search); child != NULL; child = __xml_next(child)) {//.........这里部分代码省略.........
开发者ID:KevenChang,项目名称:pacemaker,代码行数:101,


示例26: crm_ipc_buffer

const char *crm_ipc_buffer(crm_ipc_t * client){    CRM_ASSERT(client != NULL);    return client->buffer + sizeof(struct crm_ipc_response_header);}
开发者ID:credativ,项目名称:pacemaker,代码行数:6,


示例27: te_rsc_command

static gbooleante_rsc_command(crm_graph_t * graph, crm_action_t * action){    /* never overwrite stop actions in the CIB with     *   anything other than completed results     *     * Writing pending stops makes it look like the     *   resource is running again     */    xmlNode *cmd = NULL;    xmlNode *rsc_op = NULL;    gboolean rc = TRUE;    gboolean no_wait = FALSE;    gboolean is_local = FALSE;    char *counter = NULL;    const char *task = NULL;    const char *value = NULL;    const char *on_node = NULL;    const char *task_uuid = NULL;    CRM_ASSERT(action != NULL);    CRM_ASSERT(action->xml != NULL);    action->executed = FALSE;    on_node = crm_element_value(action->xml, XML_LRM_ATTR_TARGET);    CRM_CHECK(on_node != NULL && strlen(on_node) != 0,              te_log_action(LOG_ERR, "Corrupted command(id=%s) %s: no node",                            ID(action->xml), crm_str(task));              return FALSE);    rsc_op = action->xml;    task = crm_element_value(rsc_op, XML_LRM_ATTR_TASK);    task_uuid = crm_element_value(action->xml, XML_LRM_ATTR_TASK_KEY);    on_node = crm_element_value(rsc_op, XML_LRM_ATTR_TARGET);    counter =        generate_transition_key(transition_graph->id, action->id, get_target_rc(action), te_uuid);    crm_xml_add(rsc_op, XML_ATTR_TRANSITION_KEY, counter);    if (safe_str_eq(on_node, fsa_our_uname)) {        is_local = TRUE;    }    value = crm_meta_value(action->params, XML_ATTR_TE_NOWAIT);    if (crm_is_true(value)) {        no_wait = TRUE;    }    crm_info("Initiating action %d: %s %s on %s%s%s",             action->id, task, task_uuid, on_node,             is_local ? " (local)" : "", no_wait ? " - no waiting" : "");    cmd = create_request(CRM_OP_INVOKE_LRM, rsc_op, on_node,                         CRM_SYSTEM_LRMD, CRM_SYSTEM_TENGINE, NULL);    if (is_local) {        /* shortcut local resource commands */        ha_msg_input_t data = {            .msg = cmd,            .xml = rsc_op,        };        fsa_data_t msg = {            .id = 0,            .data = &data,            .data_type = fsa_dt_ha_msg,            .fsa_input = I_NULL,            .fsa_cause = C_FSA_INTERNAL,            .actions = A_LRM_INVOKE,            .origin = __FUNCTION__,        };        do_lrm_invoke(A_LRM_INVOKE, C_FSA_INTERNAL, fsa_state, I_NULL, &msg);    } else {        rc = send_cluster_message(on_node, crm_msg_lrmd, cmd, TRUE);    }    crm_free(counter);    free_xml(cmd);    action->executed = TRUE;    if (rc == FALSE) {        crm_err("Action %d failed: send", action->id);        return FALSE;    } else if (no_wait) {        action->confirmed = TRUE;        update_graph(transition_graph, action);        trigger_graph();    } else {        if (action->timeout <= 0) {            crm_err("Action %d: %s %s on %s had an invalid timeout (%dms).  Using %dms instead",                    action->id, task, task_uuid, on_node, action->timeout, graph->network_delay);            action->timeout = graph->network_delay;        }        te_start_action_timer(graph, action);//.........这里部分代码省略.........
开发者ID:fghaas,项目名称:pacemaker,代码行数:101,


示例28: cib_process_command

intcib_process_command(xmlNode * request, xmlNode ** reply, xmlNode ** cib_diff, gboolean privileged){    xmlNode *input = NULL;    xmlNode *output = NULL;    xmlNode *result_cib = NULL;    xmlNode *current_cib = NULL;#if ENABLE_ACL    xmlNode *filtered_current_cib = NULL;#endif    int call_type = 0;    int call_options = 0;    int log_level = LOG_DEBUG_4;    const char *op = NULL;    const char *section = NULL;    int rc = pcmk_ok;    int rc2 = pcmk_ok;    gboolean send_r_notify = FALSE;    gboolean global_update = FALSE;    gboolean config_changed = FALSE;    gboolean manage_counters = TRUE;    CRM_ASSERT(cib_status == pcmk_ok);    *reply = NULL;    *cib_diff = NULL;    current_cib = the_cib;    /* Start processing the request... */    op = crm_element_value(request, F_CIB_OPERATION);    crm_element_value_int(request, F_CIB_CALLOPTS, &call_options);    rc = cib_get_operation_id(op, &call_type);    if (rc == pcmk_ok && privileged == FALSE) {        rc = cib_op_can_run(call_type, call_options, privileged, global_update);    }    rc2 = cib_op_prepare(call_type, request, &input, &section);    if (rc == pcmk_ok) {        rc = rc2;    }    if (rc != pcmk_ok) {        crm_trace("Call setup failed: %s", pcmk_strerror(rc));        goto done;    } else if (cib_op_modifies(call_type) == FALSE) {#if ENABLE_ACL        if (acl_enabled(config_hash) == FALSE            || acl_filter_cib(request, current_cib, current_cib, &filtered_current_cib) == FALSE) {            rc = cib_perform_op(op, call_options, cib_op_func(call_type), TRUE,                                section, request, input, FALSE, &config_changed,                                current_cib, &result_cib, NULL, &output);        } else if (filtered_current_cib == NULL) {            crm_debug("Pre-filtered the entire cib");            rc = -EACCES;        } else {            crm_debug("Pre-filtered the queried cib according to the ACLs");            rc = cib_perform_op(op, call_options, cib_op_func(call_type), TRUE,                                section, request, input, FALSE, &config_changed,                                filtered_current_cib, &result_cib, NULL, &output);        }#else        rc = cib_perform_op(op, call_options, cib_op_func(call_type), TRUE,                            section, request, input, FALSE, &config_changed,                            current_cib, &result_cib, NULL, &output);#endif        CRM_CHECK(result_cib == NULL, free_xml(result_cib));        goto done;    }    /* Handle a valid write action */    global_update = crm_is_true(crm_element_value(request, F_CIB_GLOBAL_UPDATE));    if (global_update) {        manage_counters = FALSE;        call_options |= cib_force_diff;        CRM_CHECK(call_type == 3 || call_type == 4, crm_err("Call type: %d", call_type);                  crm_log_xml_err(request, "bad op"));    }#ifdef SUPPORT_PRENOTIFY    if ((call_options & cib_inhibit_notify) == 0) {        cib_pre_notify(call_options, op, the_cib, input);    }#endif    if (rc == pcmk_ok) {        if (call_options & cib_inhibit_bcast) {            /* skip */            crm_trace("Skipping update: inhibit broadcast");            manage_counters = FALSE;//.........这里部分代码省略.........
开发者ID:kiranmurari,项目名称:pacemaker,代码行数:101,



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


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