Beispiel #1
0
int orcm_octl_logical_group_remove(int argc, char **argv)
{
    int erri = ORCM_SUCCESS;
    char *tag = NULL;
    char *regex = NULL;
    char *err_str = NULL;

    if (4 != argc) {
        orte_show_help("help-octl.txt",
                       "octl:grouping:remove-usage", true, "invalid arguments!");
        return ORCM_ERR_BAD_PARAM;
    }
    tag = argv[2];
    regex = argv[3];

    if (ORCM_SUCCESS != (erri = orcm_logical_group_remove(tag, regex, LOGICAL_GROUP.groups))) {
        if (ORCM_ERR_NO_ANY_GROUP == erri ||
            ORCM_ERR_GROUP_NOT_EXIST == erri || ORCM_ERR_NODE_NOT_EXIST == erri) {
            orcm_err2str(erri, (const char**)(&err_str));
            orte_show_help("help-octl.txt", "octl:grouping:remove-failure", true, err_str);
            erri = ORCM_ERR_BAD_PARAM;
        }
        return erri;
    }

    if (ORCM_SUCCESS != (erri = orcm_logical_group_save_to_file(LOGICAL_GROUP.storage_filename,
                                                                LOGICAL_GROUP.groups))) {
        return erri;
    }

    ORCM_UTIL_MSG("\nGrouping: Remove done successfully!");

    return erri;
}
Beispiel #2
0
int orcm_octl_logical_group_remove(int argc, char **argv)
{
    int erri = ORCM_SUCCESS;
    char *tag = NULL;
    char *regex = NULL;
    char *err_str = NULL;
    bool save = true;

    if (4 != argc) {
        orcm_octl_usage("grouping-remove", INVALID_USG);
        return ORCM_ERR_BAD_PARAM;
    }
    tag = argv[2];
    regex = argv[3];
    if(NULL == getenv("ORCM_MCA_logical_group_config_file")){
            save = get_user_confirmation(false);
    }
    if(save) {
        if (ORCM_SUCCESS != (erri = orcm_logical_group_remove(tag, regex, LOGICAL_GROUP.groups))) {
            if (ORCM_ERR_NO_ANY_GROUP == erri ||
                ORCM_ERR_GROUP_NOT_EXIST == erri || ORCM_ERR_NODE_NOT_EXIST == erri) {
                orcm_err2str(erri, (const char**)(&err_str));
                orcm_octl_error("grouping-remove", err_str);
                erri = ORCM_ERR_BAD_PARAM;
            }
            return erri;
        }

        if (ORCM_SUCCESS != (erri = orcm_logical_group_save_to_file(LOGICAL_GROUP.storage_filename,
                                                                    LOGICAL_GROUP.groups))) {
            return erri;
        }

        orcm_octl_info("grouping-success", "Remove");
    }
    return erri;
}