diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2021-01-12 11:56:30 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2021-01-12 13:50:13 +0100 |
commit | 55e32e9cc08972ac64a745a6c7bee9a181be3c47 (patch) | |
tree | 90cc8deab39f8560879091c3824320abaadf6d01 /admin/WebConsole | |
parent | 06d220975c26b86537a9055f897177550919b8fc (diff) |
#1008 Restore support for >4 partitions
WebConsole "Partition and Format"/"Particionar y Formatear" supported
more than 4 partitions when it used SocketHidra. When we changed it to
use HTTP requests we introduced a limit of 4 partitions.
This commit:
* Restores "Partition and Format" support for more than 4 partitions.
* Adapts client-side checks (JavaScript) for more than 4 partitions and
GPT.
Diffstat (limited to 'admin/WebConsole')
-rw-r--r-- | admin/WebConsole/comandos/jscripts/Configurar.js | 41 | ||||
-rw-r--r-- | admin/WebConsole/includes/restfunctions.php | 4 |
2 files changed, 30 insertions, 15 deletions
diff --git a/admin/WebConsole/comandos/jscripts/Configurar.js b/admin/WebConsole/comandos/jscripts/Configurar.js index bda09401..aea678c6 100644 --- a/admin/WebConsole/comandos/jscripts/Configurar.js +++ b/admin/WebConsole/comandos/jscripts/Configurar.js @@ -10,7 +10,6 @@ var atributos=""; // Variable global var swc=false; // Switch para detectar cache -var swe=false; // Switch para detectar partición extendida //________________________________________________________________________________________________________ // @@ -32,7 +31,6 @@ function eliminaParticion(o,icp) var desplepar=o.parentNode.nextSibling.nextSibling.childNodes[0]; var tipar=tomavalorDesple(desplepar); // Partición if(tipar==="CACHE") swc=false; // Si es la caché se pone a false su switch - if(tipar==="EXTENDED") swe=false; // Si es la EXTENDED se pone a false su switch var tbCfg = document.getElementById("tabla_conf"); // Recupera objeto <TABLE> var trCfg = document.getElementById("TR_"+icp); // Recupera <TR> de la fila a eliminar @@ -129,6 +127,9 @@ function comprobarDatos(cc) var trCfg = document.getElementById("TR_"+cc); // Recupera primer <TR> de la configuración trCfg=trCfg.nextSibling; // Primera fila de particiones + + var swe = false; + while(trCfg.id!=="TRIMG_"+cc){ var tama=trCfg.childNodes[itama].childNodes[0].value; // Tamaño de partición @@ -212,22 +213,35 @@ function comprobarDatos(cc) } //Controles finales de los paramtros a enviar + var table_type = document.getElementById("table_type").value; - if(!swe){ // Si no se han especificado particiones extendidas ... - if(maxpar>4){ // La partición de mayor orden supera el número 4 - alert(TbMsg[7]); - return(false); + switch (table_type) { + case "MSDOS": + if (!swe) { + if (maxpar > 4) { + alert(TbMsg[7]); + return(false); + } + } else { + if (allextsize > extsize) { + alert(TbMsg["EXTSIZE"]); + return(false); + } + allpartsize += extsize; } - } - - // Alerta si las particiones lógicas son mayores que la extendida - if(swe){ - if (allextsize>extsize) { - alert(TbMsg["EXTSIZE"]); + break; + case "GPT": + if (swe) { + alert("Extended type not compatible with GPT"); return(false); } - allpartsize+=extsize; + break; + default: + alert("Disk type not compatible"); + return(false); + break; } + // Alerta si tamaño del disco menor que las particiones if (hdsize<allpartsize) { alert(TbMsg["HDSIZE"]); @@ -240,7 +254,6 @@ function comprobarDatos(cc) var RC="!"; var disco = document.disk.current_numdisk.value; - var table_type = document.getElementById("table_type").value; atributos="ttp="+table_type+"@"+"dsk="+disco+"@"+"cfg="; // Inicializa variable global de parámetros del comando diff --git a/admin/WebConsole/includes/restfunctions.php b/admin/WebConsole/includes/restfunctions.php index 8d8bf931..d45dd9c9 100644 --- a/admin/WebConsole/includes/restfunctions.php +++ b/admin/WebConsole/includes/restfunctions.php @@ -85,6 +85,7 @@ define('TYPE_TASK', 3); define('OG_SCHEDULE_COMMAND', 'command'); define('OG_SCHEDULE_PROCEDURE', 'procedure'); define('OG_SCHEDULE_TASK', 'task'); +define('PART_MAX_NUM_FIELDS', 5); $conf_file = json_decode(file_get_contents(__DIR__ . '/../../etc/ogserver.json'), true); define('OG_REST_API_TOKEN', 'Authorization: ' . $conf_file['rest']['api_token']); @@ -551,7 +552,8 @@ function setup($string_ips, $params) { $file_system = array(); $part_size = array(); $format = array(); - for ($x = 0; $x < 4; $x++) { + $num_partitions = (sizeof($matches[0]) - 5) / PART_MAX_NUM_FIELDS; + for ($x = 0; $x < $num_partitions; $x++) { $partition_number[$x] = $matches[0][5 + 5 * $x]; $partition_code[$x] = $matches[0][6 + 5 * $x]; $file_system[$x] = $matches[0][7 + 5 * $x]; |