示例#1
0
文件: lmtdb.c 项目: LaHaine/lmt
/* lmt_ost_v1: single ost (no oss info) */
void
lmt_db_insert_ost_v1 (char *s)
{
    lmt_db_t db;
    char *ossname = NULL, *ostname = NULL;
    uint64_t read_bytes, write_bytes;
    uint64_t kbytes_free, kbytes_total;
    uint64_t inodes_free, inodes_total;

    if (_init_db_ifneeded () < 0)
        goto done;
    if (lmt_ost_decode_v1 (s, &ossname, &ostname, &read_bytes, &write_bytes,
                           &kbytes_free, &kbytes_total,
                           &inodes_free, &inodes_total) < 0) {
        goto done;
    }
    if (!(db = _svc_to_db (ostname)))
        goto done;
    if (lmt_db_insert_ost_data (db, ossname, ostname, read_bytes, write_bytes,
                                kbytes_free, kbytes_total - kbytes_free,
                                inodes_free, inodes_total - inodes_free) < 0) {
        _trigger_db_reconnect ();
        goto done;
    }
done:
    if (ostname)
        free (ostname);    
    if (ossname)
        free (ossname);    
}
示例#2
0
文件: tparse.c 项目: LLNL/lmt
int
_parse_ost_v1 (const char *s)
{
    int retval = -1;
    char *ossname = NULL;
    char *name = NULL;
    uint64_t read_bytes, write_bytes;
    uint64_t kbytes_free, kbytes_total;
    uint64_t inodes_free, inodes_total;

    if (lmt_ost_decode_v1 (s, &ossname, &name, &read_bytes, &write_bytes,
              &kbytes_free, &kbytes_total, &inodes_free, &inodes_total) < 0)
        goto done;
    retval = 0;
done:
    if (name)
        free (name);
    if (ossname)
        free (ossname);
    return retval;
}