static int doModifyNode(struct nc_state_t *nc, ncMetadata * pMeta, char *stateName)
{
    int ret = EUCA_OK;
    boolean did_change_state = FALSE;

    if (!strcasecmp(stateName, "enabled")) {
        if (nc->is_enabled == FALSE) {
            nc->is_enabled = TRUE;
            did_change_state = TRUE;
        }

    } else if (!strcasecmp(stateName, "disabled")) {
        if (nc->is_enabled == TRUE) {
            nc->is_enabled = FALSE;
            did_change_state = TRUE;
        }

    } else {
        LOGERROR("unexpected state '%s' requested for the node\n", stateName);
        ret = EUCA_ERROR;
    }

    if (did_change_state) {
        LOGINFO("node state change to '%s'\n", stateName);
        if (gen_nc_xml(nc) != EUCA_OK) {
            LOGERROR("failed to update NC state on disk\n");
            ret = EUCA_ERROR;
        } else {
            LOGINFO("wrote NC state to disk\n");
        }
    }

    return ret;
}
static int doModifyNode(struct nc_state_t *nc, ncMetadata * pMeta, char *stateName)
{
    int ret = EUCA_OK;
    boolean did_change_state = FALSE;

    if (!strcasecmp(stateName, "enabled")) {
        if (nc->is_enabled == FALSE) {
            nc->is_enabled = TRUE;
            did_change_state = TRUE;
        }

    } else if (!strcasecmp(stateName, "disabled")) {
        if (nc->is_enabled == TRUE) {
            nc->is_enabled = FALSE;
            did_change_state = TRUE;
        }

    } else {
        LOGERROR("unexpected state '%s' requested for the node\n", stateName);
        ret = EUCA_ERROR;
    }

    if (did_change_state) {
        LOGINFO("node state change to '%s'\n", stateName);
        if (gen_nc_xml(nc) != EUCA_OK) {
            LOGERROR("failed to update NC state on disk\n");
            ret = EUCA_ERROR;
        } else {
            LOGINFO("wrote NC state to disk\n");
        }
    }

    return ret;
}