summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2020-08-14 12:37:36 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-08-14 12:48:21 +0200
commitca545d39bd68d156a0dddbab204e743202dbfba3 (patch)
tree59c1f02c30eb18237c3602d64fe8acee30fd94d0
parent060e31cb53386282f1995937c18fe39855865046 (diff)
#998 disable incremental image API
This API is not supported by ogClient yet and it uses the obsolete socket hydra API.
-rw-r--r--src/core.c17
-rw-r--r--src/main.c6
-rw-r--r--src/ogAdmLib.h1
-rw-r--r--src/ogAdmServer.c58
-rw-r--r--src/ogAdmServer.h11
-rw-r--r--src/rest.c473
6 files changed, 0 insertions, 566 deletions
diff --git a/src/core.c b/src/core.c
index f7c25f5..0d90de4 100644
--- a/src/core.c
+++ b/src/core.c
@@ -29,7 +29,6 @@ static void og_client_release(struct ev_loop *loop, struct og_client *cli)
syslog(LOG_DEBUG, "closing keepalive connection for %s:%hu in slot %d\n",
inet_ntoa(cli->addr.sin_addr),
ntohs(cli->addr.sin_port), cli->keepalive_idx);
- tbsockets[cli->keepalive_idx].cli = NULL;
}
list_del(&cli->list);
@@ -38,21 +37,6 @@ static void og_client_release(struct ev_loop *loop, struct og_client *cli)
free(cli);
}
-static void og_client_keepalive(struct ev_loop *loop, struct og_client *cli)
-{
- struct og_client *old_cli;
-
- old_cli = tbsockets[cli->keepalive_idx].cli;
- if (old_cli && old_cli != cli) {
- syslog(LOG_DEBUG, "closing old keepalive connection for %s:%hu\n",
- inet_ntoa(old_cli->addr.sin_addr),
- ntohs(old_cli->addr.sin_port));
-
- og_client_release(loop, old_cli);
- }
- tbsockets[cli->keepalive_idx].cli = cli;
-}
-
static void og_client_reset_state(struct og_client *cli)
{
cli->state = OG_CLIENT_RECEIVING_HEADER;
@@ -182,7 +166,6 @@ static void og_client_read_cb(struct ev_loop *loop, struct ev_io *io, int events
syslog(LOG_DEBUG, "leaving client %s:%hu in keepalive mode\n",
inet_ntoa(cli->addr.sin_addr),
ntohs(cli->addr.sin_port));
- og_client_keepalive(loop, cli);
og_client_reset_state(cli);
}
break;
diff --git a/src/main.c b/src/main.c
index 5f6d164..48f0c00 100644
--- a/src/main.c
+++ b/src/main.c
@@ -24,7 +24,6 @@ int main(int argc, char *argv[])
{
struct ev_io ev_io_server_rest, ev_io_agent_rest;
struct og_server_cfg cfg = {};
- int i;
og_loop = ev_default_loop(0);
@@ -45,11 +44,6 @@ int main(int argc, char *argv[])
from_json_to_legacy(&cfg);
}
- for (i = 0; i < MAXIMOS_CLIENTES; i++) {
- tbsockets[i].ip[0] = '\0';
- tbsockets[i].cli = NULL;
- }
-
socket_rest = og_socket_server_init("8888");
if (socket_rest < 0) {
syslog(LOG_ERR, "Cannot open REST API server socket\n");
diff --git a/src/ogAdmLib.h b/src/ogAdmLib.h
index c6c251d..ee8870e 100644
--- a/src/ogAdmLib.h
+++ b/src/ogAdmLib.h
@@ -29,7 +29,6 @@
#define LONGITUD_PARAMETROS 8192 // Longitud estandar de la información de la trama (parámetros)
#define MAXCMD_PARAMETROS 200 // Máximo número de parámetros de una trama
-#define MAXIMOS_CLIENTES 4000 // Máximo número de conexiones con ordenadores clientes
#define MAXIMAS_FUNCIONES LONSTD // Máximo número de funciones que procesan los mensajes entre servicio y clientes
#define CLIENTE_OCUPADO "BSY" // Cliente ocupado
diff --git a/src/ogAdmServer.c b/src/ogAdmServer.c
index 90dd0c8..de7fa61 100644
--- a/src/ogAdmServer.c
+++ b/src/ogAdmServer.c
@@ -33,8 +33,6 @@ char servidoradm[4096]; // Dirección IP del servidor de administración
char puerto[4096]; // Puerto de comunicación
char db_port[4096];
-SOCKETCL tbsockets[MAXIMOS_CLIENTES];
-
struct og_dbi_config dbi_config = {
.user = usuario,
.passwd = pasguor,
@@ -141,62 +139,6 @@ bool tomaConfiguracion(const char *filecfg)
#define OG_CMD_MAXLEN 64
// ________________________________________________________________________________________________________
-// Función: clienteDisponible
-//
-// Descripción:
-// Comprueba la disponibilidad del cliente para recibir comandos interactivos
-// Parametros:
-// - ip : La ip del cliente a buscar
-// - idx: (Salida) Indice que ocupa el cliente, de estar ya registrado
-// Devuelve:
-// true: Si el cliente está disponible
-// false: En caso contrario
-// ________________________________________________________________________________________________________
-bool clienteDisponible(char *ip, int* idx)
-{
- int estado;
-
- if (clienteExistente(ip, idx)) {
- estado = strcmp(tbsockets[*idx].estado, CLIENTE_OCUPADO); // Cliente ocupado
- if (estado == 0)
- return false;
-
- estado = strcmp(tbsockets[*idx].estado, CLIENTE_APAGADO); // Cliente apagado
- if (estado == 0)
- return false;
-
- estado = strcmp(tbsockets[*idx].estado, CLIENTE_INICIANDO); // Cliente en proceso de inclusión
- if (estado == 0)
- return false;
-
- return true; // En caso contrario el cliente está disponible
- }
- return false; // Cliente no está registrado en el sistema
-}
-// ________________________________________________________________________________________________________
-// Función: clienteExistente
-//
-// Descripción:
-// Comprueba si el cliente está registrado en la tabla de socket del sistema
-// Parametros:
-// - ip : La ip del cliente a buscar
-// - idx:(Salida) Indice que ocupa el cliente, de estar ya registrado
-// Devuelve:
-// true: Si el cliente está registrado
-// false: En caso contrario
-// ________________________________________________________________________________________________________
-bool clienteExistente(char *ip, int* idx)
-{
- int i;
- for (i = 0; i < MAXIMOS_CLIENTES; i++) {
- if (contieneIP(ip, tbsockets[i].ip)) { // Si existe la IP en la cadena
- *idx = i;
- return true;
- }
- }
- return false;
-}
-// ________________________________________________________________________________________________________
// Función: actualizaConfiguracion
//
// Descripción:
diff --git a/src/ogAdmServer.h b/src/ogAdmServer.h
index f51b7be..049c5e0 100644
--- a/src/ogAdmServer.h
+++ b/src/ogAdmServer.h
@@ -32,19 +32,8 @@ extern char puerto[4096];
extern char db_port[4096];
struct og_client;
-
-typedef struct{ // Estructura usada para guardar información de los clientes
- char ip[LONIP]; // IP del cliente
- char estado[4]; // Tipo de Sistema Operativo en que se encuentra el cliente
- struct og_client *cli;
-}SOCKETCL;
-
-extern SOCKETCL tbsockets[MAXIMOS_CLIENTES];
-
struct og_dbi;
-bool clienteExistente(char *,int *);
-bool clienteDisponible(char *,int *);
bool actualizaConfiguracion(struct og_dbi *,char* ,int);
bool Levanta(char**, char**, char**, int, char*);
bool WakeUp(int,char*,char*,char*,char*);
diff --git a/src/rest.c b/src/rest.c
index 2256788..e9b09cd 100644
--- a/src/rest.c
+++ b/src/rest.c
@@ -29,49 +29,6 @@
struct ev_loop *og_loop;
-static TRAMA *og_msg_alloc(char *data, unsigned int len)
-{
- TRAMA *ptrTrama;
-
- ptrTrama = calloc(1, sizeof(TRAMA));
- if (!ptrTrama) {
- syslog(LOG_ERR, "OOM\n");
- return NULL;
- }
-
- initParametros(ptrTrama, len);
- memcpy(ptrTrama, "@JMMLCAMDJ_MCDJ", LONGITUD_CABECERATRAMA);
- memcpy(ptrTrama->parametros, data, len);
- ptrTrama->lonprm = len;
-
- return ptrTrama;
-}
-
-static void og_msg_free(TRAMA *ptrTrama)
-{
- free(ptrTrama->parametros);
- free(ptrTrama);
-}
-
-static bool og_send_cmd(char *ips_array[], int ips_array_len,
- const char *state, TRAMA *ptrTrama)
-{
- int i, idx;
-
- for (i = 0; i < ips_array_len; i++) {
- if (clienteDisponible(ips_array[i], &idx)) { // Si el cliente puede recibir comandos
- int sock = tbsockets[idx].cli ? tbsockets[idx].cli->io.fd : -1;
-
- strcpy(tbsockets[idx].estado, state); // Actualiza el estado del cliente
- if (sock >= 0 && !mandaTrama(&sock, ptrTrama)) {
- syslog(LOG_ERR, "failed to send response to %s:%s\n",
- ips_array[i], strerror(errno));
- }
- }
- }
- return true;
-}
-
#define OG_REST_PARAM_ADDR (1UL << 0)
#define OG_REST_PARAM_MAC (1UL << 1)
#define OG_REST_PARAM_WOL_TYPE (1UL << 2)
@@ -195,58 +152,6 @@ static int og_json_parse_clients(json_t *element, struct og_msg_params *params)
return 0;
}
-static int og_json_parse_sync_params(json_t *element,
- struct og_msg_params *params)
-{
- const char *key;
- json_t *value;
- int err = 0;
-
- json_object_foreach(element, key, value) {
- if (!strcmp(key, "sync")) {
- err = og_json_parse_string(value, &params->sync_setup.sync);
- params->flags |= OG_REST_PARAM_SYNC_SYNC;
- } else if (!strcmp(key, "diff")) {
- err = og_json_parse_string(value, &params->sync_setup.diff);
- params->flags |= OG_REST_PARAM_SYNC_DIFF;
- } else if (!strcmp(key, "remove")) {
- err = og_json_parse_string(value, &params->sync_setup.remove);
- params->flags |= OG_REST_PARAM_SYNC_REMOVE;
- } else if (!strcmp(key, "compress")) {
- err = og_json_parse_string(value, &params->sync_setup.compress);
- params->flags |= OG_REST_PARAM_SYNC_COMPRESS;
- } else if (!strcmp(key, "cleanup")) {
- err = og_json_parse_string(value, &params->sync_setup.cleanup);
- params->flags |= OG_REST_PARAM_SYNC_CLEANUP;
- } else if (!strcmp(key, "cache")) {
- err = og_json_parse_string(value, &params->sync_setup.cache);
- params->flags |= OG_REST_PARAM_SYNC_CACHE;
- } else if (!strcmp(key, "cleanup_cache")) {
- err = og_json_parse_string(value, &params->sync_setup.cleanup_cache);
- params->flags |= OG_REST_PARAM_SYNC_CLEANUP_CACHE;
- } else if (!strcmp(key, "remove_dst")) {
- err = og_json_parse_string(value, &params->sync_setup.remove_dst);
- params->flags |= OG_REST_PARAM_SYNC_REMOVE_DST;
- } else if (!strcmp(key, "diff_id")) {
- err = og_json_parse_string(value, &params->sync_setup.diff_id);
- params->flags |= OG_REST_PARAM_SYNC_DIFF_ID;
- } else if (!strcmp(key, "diff_name")) {
- err = og_json_parse_string(value, &params->sync_setup.diff_name);
- params->flags |= OG_REST_PARAM_SYNC_DIFF_NAME;
- } else if (!strcmp(key, "path")) {
- err = og_json_parse_string(value, &params->sync_setup.path);
- params->flags |= OG_REST_PARAM_SYNC_PATH;
- } else if (!strcmp(key, "method")) {
- err = og_json_parse_string(value, &params->sync_setup.method);
- params->flags |= OG_REST_PARAM_SYNC_METHOD;
- }
-
- if (err != 0)
- return err;
- }
- return err;
-}
-
static int og_json_parse_partition_setup(json_t *element,
struct og_msg_params *params)
{
@@ -1456,344 +1361,6 @@ static int og_cmd_run_schedule(json_t *element, struct og_msg_params *params)
NULL);
}
-static int og_cmd_create_basic_image(json_t *element, struct og_msg_params *params)
-{
- char buf[4096] = {};
- int err = 0, len;
- const char *key;
- json_t *value;
- TRAMA *msg;
-
- if (json_typeof(element) != JSON_OBJECT)
- return -1;
-
- json_object_foreach(element, key, value) {
- if (!strcmp(key, "clients")) {
- err = og_json_parse_clients(value, params);
- } else if (!strcmp(key, "disk")) {
- err = og_json_parse_string(value, &params->disk);
- params->flags |= OG_REST_PARAM_DISK;
- } else if (!strcmp(key, "partition")) {
- err = og_json_parse_string(value, &params->partition);
- params->flags |= OG_REST_PARAM_PARTITION;
- } else if (!strcmp(key, "code")) {
- err = og_json_parse_string(value, &params->code);
- params->flags |= OG_REST_PARAM_CODE;
- } else if (!strcmp(key, "id")) {
- err = og_json_parse_string(value, &params->id);
- params->flags |= OG_REST_PARAM_ID;
- } else if (!strcmp(key, "name")) {
- err = og_json_parse_string(value, &params->name);
- params->flags |= OG_REST_PARAM_NAME;
- } else if (!strcmp(key, "repository")) {
- err = og_json_parse_string(value, &params->repository);
- params->flags |= OG_REST_PARAM_REPO;
- } else if (!strcmp(key, "sync_params")) {
- err = og_json_parse_sync_params(value, params);
- }
-
- if (err < 0)
- break;
- }
-
- if (!og_msg_params_validate(params, OG_REST_PARAM_ADDR |
- OG_REST_PARAM_DISK |
- OG_REST_PARAM_PARTITION |
- OG_REST_PARAM_CODE |
- OG_REST_PARAM_ID |
- OG_REST_PARAM_NAME |
- OG_REST_PARAM_REPO |
- OG_REST_PARAM_SYNC_SYNC |
- OG_REST_PARAM_SYNC_DIFF |
- OG_REST_PARAM_SYNC_REMOVE |
- OG_REST_PARAM_SYNC_COMPRESS |
- OG_REST_PARAM_SYNC_CLEANUP |
- OG_REST_PARAM_SYNC_CACHE |
- OG_REST_PARAM_SYNC_CLEANUP_CACHE |
- OG_REST_PARAM_SYNC_REMOVE_DST))
- return -1;
-
- len = snprintf(buf, sizeof(buf),
- "nfn=CrearImagenBasica\rdsk=%s\rpar=%s\rcpt=%s\ridi=%s\r"
- "nci=%s\ripr=%s\rrti=\rmsy=%s\rwhl=%s\reli=%s\rcmp=%s\rbpi=%s\r"
- "cpc=%s\rbpc=%s\rnba=%s\r",
- params->disk, params->partition, params->code, params->id,
- params->name, params->repository, params->sync_setup.sync,
- params->sync_setup.diff, params->sync_setup.remove,
- params->sync_setup.compress, params->sync_setup.cleanup,
- params->sync_setup.cache, params->sync_setup.cleanup_cache,
- params->sync_setup.remove_dst);
-
- msg = og_msg_alloc(buf, len);
- if (!msg)
- return -1;
-
- og_send_cmd((char **)params->ips_array, params->ips_array_len,
- CLIENTE_OCUPADO, msg);
-
- og_msg_free(msg);
-
- return 0;
-}
-
-static int og_cmd_create_incremental_image(json_t *element, struct og_msg_params *params)
-{
- char buf[4096] = {};
- int err = 0, len;
- const char *key;
- json_t *value;
- TRAMA *msg;
-
- if (json_typeof(element) != JSON_OBJECT)
- return -1;
-
- json_object_foreach(element, key, value) {
- if (!strcmp(key, "clients"))
- err = og_json_parse_clients(value, params);
- else if (!strcmp(key, "disk")) {
- err = og_json_parse_string(value, &params->disk);
- params->flags |= OG_REST_PARAM_DISK;
- } else if (!strcmp(key, "partition")) {
- err = og_json_parse_string(value, &params->partition);
- params->flags |= OG_REST_PARAM_PARTITION;
- } else if (!strcmp(key, "id")) {
- err = og_json_parse_string(value, &params->id);
- params->flags |= OG_REST_PARAM_ID;
- } else if (!strcmp(key, "name")) {
- err = og_json_parse_string(value, &params->name);
- params->flags |= OG_REST_PARAM_NAME;
- } else if (!strcmp(key, "repository")) {
- err = og_json_parse_string(value, &params->repository);
- params->flags |= OG_REST_PARAM_REPO;
- } else if (!strcmp(key, "sync_params")) {
- err = og_json_parse_sync_params(value, params);
- }
-
- if (err < 0)
- break;
- }
-
- if (!og_msg_params_validate(params, OG_REST_PARAM_ADDR |
- OG_REST_PARAM_DISK |
- OG_REST_PARAM_PARTITION |
- OG_REST_PARAM_ID |
- OG_REST_PARAM_NAME |
- OG_REST_PARAM_REPO |
- OG_REST_PARAM_SYNC_SYNC |
- OG_REST_PARAM_SYNC_PATH |
- OG_REST_PARAM_SYNC_DIFF |
- OG_REST_PARAM_SYNC_DIFF_ID |
- OG_REST_PARAM_SYNC_DIFF_NAME |
- OG_REST_PARAM_SYNC_REMOVE |
- OG_REST_PARAM_SYNC_COMPRESS |
- OG_REST_PARAM_SYNC_CLEANUP |
- OG_REST_PARAM_SYNC_CACHE |
- OG_REST_PARAM_SYNC_CLEANUP_CACHE |
- OG_REST_PARAM_SYNC_REMOVE_DST))
- return -1;
-
- len = snprintf(buf, sizeof(buf),
- "nfn=CrearSoftIncremental\rdsk=%s\rpar=%s\ridi=%s\rnci=%s\r"
- "rti=%s\ripr=%s\ridf=%s\rncf=%s\rmsy=%s\rwhl=%s\reli=%s\rcmp=%s\r"
- "bpi=%s\rcpc=%s\rbpc=%s\rnba=%s\r",
- params->disk, params->partition, params->id, params->name,
- params->sync_setup.path, params->repository, params->sync_setup.diff_id,
- params->sync_setup.diff_name, params->sync_setup.sync,
- params->sync_setup.diff, params->sync_setup.remove_dst,
- params->sync_setup.compress, params->sync_setup.cleanup,
- params->sync_setup.cache, params->sync_setup.cleanup_cache,
- params->sync_setup.remove_dst);
-
- msg = og_msg_alloc(buf, len);
- if (!msg)
- return -1;
-
- og_send_cmd((char **)params->ips_array, params->ips_array_len,
- CLIENTE_OCUPADO, msg);
-
- og_msg_free(msg);
-
- return 0;
-}
-
-static int og_cmd_restore_basic_image(json_t *element, struct og_msg_params *params)
-{
- char buf[4096] = {};
- int err = 0, len;
- const char *key;
- json_t *value;
- TRAMA *msg;
-
- if (json_typeof(element) != JSON_OBJECT)
- return -1;
-
- json_object_foreach(element, key, value) {
- if (!strcmp(key, "clients")) {
- err = og_json_parse_clients(value, params);
- } else if (!strcmp(key, "disk")) {
- err = og_json_parse_string(value, &params->disk);
- params->flags |= OG_REST_PARAM_DISK;
- } else if (!strcmp(key, "partition")) {
- err = og_json_parse_string(value, &params->partition);
- params->flags |= OG_REST_PARAM_PARTITION;
- } else if (!strcmp(key, "id")) {
- err = og_json_parse_string(value, &params->id);
- params->flags |= OG_REST_PARAM_ID;
- } else if (!strcmp(key, "name")) {
- err = og_json_parse_string(value, &params->name);
- params->flags |= OG_REST_PARAM_NAME;
- } else if (!strcmp(key, "repository")) {
- err = og_json_parse_string(value, &params->repository);
- params->flags |= OG_REST_PARAM_REPO;
- } else if (!strcmp(key, "profile")) {
- err = og_json_parse_string(value, &params->profile);
- params->flags |= OG_REST_PARAM_PROFILE;
- } else if (!strcmp(key, "type")) {
- err = og_json_parse_string(value, &params->type);
- params->flags |= OG_REST_PARAM_TYPE;
- } else if (!strcmp(key, "sync_params")) {
- err = og_json_parse_sync_params(value, params);
- }
-
- if (err < 0)
- break;
- }
-
- if (!og_msg_params_validate(params, OG_REST_PARAM_ADDR |
- OG_REST_PARAM_DISK |
- OG_REST_PARAM_PARTITION |
- OG_REST_PARAM_ID |
- OG_REST_PARAM_NAME |
- OG_REST_PARAM_REPO |
- OG_REST_PARAM_PROFILE |
- OG_REST_PARAM_TYPE |
- OG_REST_PARAM_SYNC_PATH |
- OG_REST_PARAM_SYNC_METHOD |
- OG_REST_PARAM_SYNC_SYNC |
- OG_REST_PARAM_SYNC_DIFF |
- OG_REST_PARAM_SYNC_REMOVE |
- OG_REST_PARAM_SYNC_COMPRESS |
- OG_REST_PARAM_SYNC_CLEANUP |
- OG_REST_PARAM_SYNC_CACHE |
- OG_REST_PARAM_SYNC_CLEANUP_CACHE |
- OG_REST_PARAM_SYNC_REMOVE_DST))
- return -1;
-
- len = snprintf(buf, sizeof(buf),
- "nfn=RestaurarImagenBasica\rdsk=%s\rpar=%s\ridi=%s\rnci=%s\r"
- "ipr=%s\rifs=%s\rrti=%s\rmet=%s\rmsy=%s\rtpt=%s\rwhl=%s\r"
- "eli=%s\rcmp=%s\rbpi=%s\rcpc=%s\rbpc=%s\rnba=%s\r",
- params->disk, params->partition, params->id, params->name,
- params->repository, params->profile, params->sync_setup.path,
- params->sync_setup.method, params->sync_setup.sync, params->type,
- params->sync_setup.diff, params->sync_setup.remove,
- params->sync_setup.compress, params->sync_setup.cleanup,
- params->sync_setup.cache, params->sync_setup.cleanup_cache,
- params->sync_setup.remove_dst);
-
- msg = og_msg_alloc(buf, len);
- if (!msg)
- return -1;
-
- og_send_cmd((char **)params->ips_array, params->ips_array_len,
- CLIENTE_OCUPADO, msg);
-
- og_msg_free(msg);
-
- return 0;
-}
-
-static int og_cmd_restore_incremental_image(json_t *element, struct og_msg_params *params)
-{
- char buf[4096] = {};
- int err = 0, len;
- const char *key;
- json_t *value;
- TRAMA *msg;
-
- if (json_typeof(element) != JSON_OBJECT)
- return -1;
-
- json_object_foreach(element, key, value) {
- if (!strcmp(key, "clients")) {
- err = og_json_parse_clients(value, params);
- } else if (!strcmp(key, "disk")) {
- err = og_json_parse_string(value, &params->disk);
- params->flags |= OG_REST_PARAM_DISK;
- } else if (!strcmp(key, "partition")) {
- err = og_json_parse_string(value, &params->partition);
- params->flags |= OG_REST_PARAM_PARTITION;
- } else if (!strcmp(key, "id")) {
- err = og_json_parse_string(value, &params->id);
- params->flags |= OG_REST_PARAM_ID;
- } else if (!strcmp(key, "name")) {
- err = og_json_parse_string(value, &params->name);
- params->flags |= OG_REST_PARAM_NAME;
- } else if (!strcmp(key, "repository")) {
- err = og_json_parse_string(value, &params->repository);
- params->flags |= OG_REST_PARAM_REPO;
- } else if (!strcmp(key, "profile")) {
- err = og_json_parse_string(value, &params->profile);
- params->flags |= OG_REST_PARAM_PROFILE;
- } else if (!strcmp(key, "type")) {
- err = og_json_parse_string(value, &params->type);
- params->flags |= OG_REST_PARAM_TYPE;
- } else if (!strcmp(key, "sync_params")) {
- err = og_json_parse_sync_params(value, params);
- }
-
- if (err < 0)
- break;
- }
-
- if (!og_msg_params_validate(params, OG_REST_PARAM_ADDR |
- OG_REST_PARAM_DISK |
- OG_REST_PARAM_PARTITION |
- OG_REST_PARAM_ID |
- OG_REST_PARAM_NAME |
- OG_REST_PARAM_REPO |
- OG_REST_PARAM_PROFILE |
- OG_REST_PARAM_TYPE |
- OG_REST_PARAM_SYNC_DIFF_ID |
- OG_REST_PARAM_SYNC_DIFF_NAME |
- OG_REST_PARAM_SYNC_PATH |
- OG_REST_PARAM_SYNC_METHOD |
- OG_REST_PARAM_SYNC_SYNC |
- OG_REST_PARAM_SYNC_DIFF |
- OG_REST_PARAM_SYNC_REMOVE |
- OG_REST_PARAM_SYNC_COMPRESS |
- OG_REST_PARAM_SYNC_CLEANUP |
- OG_REST_PARAM_SYNC_CACHE |
- OG_REST_PARAM_SYNC_CLEANUP_CACHE |
- OG_REST_PARAM_SYNC_REMOVE_DST))
- return -1;
-
- len = snprintf(buf, sizeof(buf),
- "nfn=RestaurarSoftIncremental\rdsk=%s\rpar=%s\ridi=%s\rnci=%s\r"
- "ipr=%s\rifs=%s\ridf=%s\rncf=%s\rrti=%s\rmet=%s\rmsy=%s\r"
- "tpt=%s\rwhl=%s\reli=%s\rcmp=%s\rbpi=%s\rcpc=%s\rbpc=%s\r"
- "nba=%s\r",
- params->disk, params->partition, params->id, params->name,
- params->repository, params->profile, params->sync_setup.diff_id,
- params->sync_setup.diff_name, params->sync_setup.path,
- params->sync_setup.method, params->sync_setup.sync, params->type,
- params->sync_setup.diff, params->sync_setup.remove,
- params->sync_setup.compress, params->sync_setup.cleanup,
- params->sync_setup.cache, params->sync_setup.cleanup_cache,
- params->sync_setup.remove_dst);
-
- msg = og_msg_alloc(buf, len);
- if (!msg)
- return -1;
-
- og_send_cmd((char **)params->ips_array, params->ips_array_len,
- CLIENTE_OCUPADO, msg);
-
- og_msg_free(msg);
-
- return 0;
-}
-
static LIST_HEAD(cmd_list);
const struct og_cmd *og_cmd_find(const char *client_ip)
@@ -3542,26 +3109,6 @@ int og_client_state_process_payload_rest(struct og_client *cli)
return og_client_bad_request(cli);
}
err = og_cmd_software(root, &params);
- } else if (!strncmp(cmd, "image/create/basic",
- strlen("image/create/basic"))) {
- if (method != OG_METHOD_POST)
- return og_client_method_not_found(cli);
-
- if (!root) {
- syslog(LOG_ERR, "command create with no payload\n");
- return og_client_bad_request(cli);
- }
- err = og_cmd_create_basic_image(root, &params);
- } else if (!strncmp(cmd, "image/create/incremental",
- strlen("image/create/incremental"))) {
- if (method != OG_METHOD_POST)
- return og_client_method_not_found(cli);
-
- if (!root) {
- syslog(LOG_ERR, "command create with no payload\n");
- return og_client_bad_request(cli);
- }
- err = og_cmd_create_incremental_image(root, &params);
} else if (!strncmp(cmd, "image/create", strlen("image/create"))) {
if (method != OG_METHOD_POST)
return og_client_method_not_found(cli);
@@ -3571,26 +3118,6 @@ int og_client_state_process_payload_rest(struct og_client *cli)
return og_client_bad_request(cli);
}
err = og_cmd_create_image(root, &params);
- } else if (!strncmp(cmd, "image/restore/basic",
- strlen("image/restore/basic"))) {
- if (method != OG_METHOD_POST)
- return og_client_method_not_found(cli);
-
- if (!root) {
- syslog(LOG_ERR, "command create with no payload\n");
- return og_client_bad_request(cli);
- }
- err = og_cmd_restore_basic_image(root, &params);
- } else if (!strncmp(cmd, "image/restore/incremental",
- strlen("image/restore/incremental"))) {
- if (method != OG_METHOD_POST)
- return og_client_method_not_found(cli);
-
- if (!root) {
- syslog(LOG_ERR, "command create with no payload\n");
- return og_client_bad_request(cli);
- }
- err = og_cmd_restore_incremental_image(root, &params);
} else if (!strncmp(cmd, "image/restore", strlen("image/restore"))) {
if (method != OG_METHOD_POST)
return og_client_method_not_found(cli);