예제 #1
0
static int stonith_manual_ack(xmlNode *msg, remote_fencing_op_t *op)
{
    async_command_t *cmd = create_async_command(msg);
    xmlNode *dev = get_xpath_object("//@"F_STONITH_TARGET, msg, LOG_ERR);

    if(cmd == NULL) {
        return -EINVAL;
    }

    cmd->device = strdup("manual_ack");
    cmd->remote = strdup(op->id);

    crm_notice("Injecting manual confirmation that %s is safely off/down",
               crm_element_value(dev, F_STONITH_TARGET));

    st_child_done(0, 0, cmd);
    return pcmk_ok;
}
예제 #2
0
static gboolean stonith_device_execute(stonith_device_t *device)
{
    int rc = 0;
    int exec_rc = 0;
    async_command_t *cmd = NULL;
    CRM_CHECK(device != NULL, return FALSE);

    if(device->active_pid) {	
	crm_trace("%s is still active with pid %u", device->id, device->active_pid);
	return TRUE;
    }
    
    if(device->pending_ops) {
	GList *first = device->pending_ops;
	device->pending_ops = g_list_remove_link(device->pending_ops, first);
	cmd = first->data;
	g_list_free_1(first);
    }

    if(cmd == NULL) {
	crm_trace("Nothing further to do for %s", device->id);
	return TRUE;
    }
    
    cmd->device = crm_strdup(device->id);
    exec_rc = run_stonith_agent(device->agent, cmd->action, cmd->victim,
				device->params, device->aliases, &rc, NULL, cmd);

    if(exec_rc > 0) {
	crm_debug("Operation %s%s%s on %s is active with pid: %d",
		  cmd->action, cmd->victim?" for node ":"", cmd->victim?cmd->victim:"",
		  device->id, exec_rc);
	device->active_pid = exec_rc;
	
    } else {
	crm_warn("Operation %s%s%s on %s failed (%d/%d)",
		 cmd->action, cmd->victim?" for node ":"", cmd->victim?cmd->victim:"",
		 device->id, exec_rc, rc);
	st_child_done(0, rc<0?rc:exec_rc, cmd);
    }
    return TRUE;
}