From 12d8fff3efef35aa61777f82133e627030bc0b27 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Fri, 14 May 2021 10:45:59 +0200 Subject: #1037 Add disk type Add ogServer support for parsing and storing in the DB disk type data from ogClient refresh response. See also commits with #1037 in ogClient and WebConsole repo. --- src/ogAdmServer.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/ogAdmServer.c') diff --git a/src/ogAdmServer.c b/src/ogAdmServer.c index 77ddff8..5d46765 100644 --- a/src/ogAdmServer.c +++ b/src/ogAdmServer.c @@ -47,8 +47,8 @@ bool actualizaConfiguracion(struct og_dbi *dbi, char *cfg, int ido) { int lon, p, c,i, dato, swu, idsoi, idsfi,k; - char *ptrPar[MAXPAR], *ptrCfg[7], *ptrDual[2], tbPar[LONSTD]; - char *ser, *disk, *par, *cpt, *sfi, *soi, *tam, *uso; // Parametros de configuración. + char *ptrPar[MAXPAR], *ptrCfg[8], *ptrDual[2], tbPar[LONSTD]; + char *ser, *disk, *disk_type, *par, *cpt, *sfi, *soi, *tam, *uso; // Parametros de configuración. dbi_result result, result_update; const char *msglog; @@ -79,7 +79,7 @@ bool actualizaConfiguracion(struct og_dbi *dbi, char *cfg, int ido) } // Distribución de particionado. - disk = par = cpt = sfi = soi = tam = uso = NULL; + disk = disk_type = par = cpt = sfi = soi = tam = uso = NULL; splitCadena(ptrDual, ptrCfg[0], '='); disk = ptrDual[1]; // Número de disco @@ -118,6 +118,12 @@ bool actualizaConfiguracion(struct og_dbi *dbi, char *cfg, int ido) splitCadena(ptrDual, ptrCfg[6], '='); uso = ptrDual[1]; // Porcentaje de uso del S.F. + k = splitCadena(ptrDual, ptrCfg[7], '='); + if (k == 2) + disk_type = ptrDual[1]; + else + disk_type = NULL; + lon += sprintf(tbPar + lon, "(%s, %s),", disk, par); result = dbi_conn_queryf(dbi->conn, @@ -133,9 +139,9 @@ bool actualizaConfiguracion(struct og_dbi *dbi, char *cfg, int ido) } if (!dbi_result_next_row(result)) { result_update = dbi_conn_queryf(dbi->conn, - "INSERT INTO ordenadores_particiones(idordenador,numdisk,numpar,codpar,tamano,uso,idsistemafichero,idnombreso,idimagen)" - " VALUES(%d,%s,%s,0x%s,%s,%s,%d,%d,0)", - ido, disk, par, cpt, tam, uso, idsfi, idsoi); + "INSERT INTO ordenadores_particiones(idordenador,numdisk,disk_type,numpar,codpar,tamano,uso,idsistemafichero,idnombreso,idimagen)" + " VALUES(%d,%s,'%s',%s,0x%s,%s,%s,%d,%d,0)", + ido, disk, disk_type, par, cpt, tam, uso, idsfi, idsoi); if (!result_update) { dbi_conn_error(dbi->conn, &msglog); syslog(LOG_ERR, "failed to query database (%s:%d) %s\n", -- cgit v1.2.3-18-g5258