Ejemplo n.º 1
0
int
ldbm_instance_postadd_instance_entry_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* entryAfter, int *returncode, char *returntext, void *arg)
{
    backend *be = NULL;
    struct ldbm_instance *inst;
    char *instance_name;
    struct ldbminfo *li = (struct ldbminfo *)arg;
    int rval = 0;

    parse_ldbm_instance_entry(entryBefore, &instance_name);
    rval = ldbm_instance_generate(li, instance_name, &be);
    if (rval) {
        LDAPDebug(LDAP_DEBUG_ANY,
            "ldbm_instance_postadd_instance_entry_callback: "
            "ldbm_instance_generate (%s) failed (%d)\n",
            instance_name, rval, 0);
    }

    inst = ldbm_instance_find_by_name(li, instance_name);

    /* Add default indexes */
    ldbm_instance_create_default_user_indexes(inst);

    /* Initialize and register callbacks for VLV indexes */
    vlv_init(inst);

    /* this is an ACTUAL ADD being done while the server is running!
     * start up the appropriate backend...
     */
    rval = ldbm_instance_start(be);
    if (0 != rval)
    {
        LDAPDebug(LDAP_DEBUG_ANY,
            "ldbm_instance_postadd_instance_entry_callback: "
            "ldbm_instnace_start (%s) failed (%d)\n",
            instance_name, rval, 0);
    }

    slapi_ch_free((void **)&instance_name);

    /* instance must be fully ready before we call this */
    slapi_mtn_be_started(be);

    return SLAPI_DSE_CALLBACK_OK;
}
Ejemplo n.º 2
0
/* Walks down the set of instances, starting each one. */
int 
ldbm_instance_startall(struct ldbminfo *li)
{
    Object *inst_obj;
    ldbm_instance *inst;
    int rc = 0;

    inst_obj = objset_first_obj(li->li_instance_set);
    while (inst_obj != NULL)  {
        int rc1;
        inst = (ldbm_instance *) object_get_data(inst_obj);
        ldbm_instance_set_flags(inst);
        rc1 = ldbm_instance_start(inst->inst_be);
    if (rc1 != 0) {
        rc = rc1;
    } else {
        vlv_init(inst);
        slapi_mtn_be_started(inst->inst_be);
    }
        inst_obj = objset_next_obj(li->li_instance_set, inst_obj);
    }

    return rc;
}