From eabb7bdb6699201db39fee3049e0bb7dcce94ab4 Mon Sep 17 00:00:00 2001 From: Irina Gómez Date: Mon, 22 Jun 2020 14:26:24 +0200 Subject: #894 Console 'Restore Image' Command: Supports disk image. The form allows you to select the disk image to restore. The interface script checks image type, disk or partition, and uses the appropriate script. --- admin/Interface/RestaurarImagen | 9 ++- admin/WebConsole/comandos/RestaurarImagen.php | 54 +++++++++++++ .../comandos/jscripts/RestaurarImagen.js | 6 +- admin/WebConsole/includes/pintaParticiones.php | 93 ++++++++++++++-------- 4 files changed, 127 insertions(+), 35 deletions(-) diff --git a/admin/Interface/RestaurarImagen b/admin/Interface/RestaurarImagen index 6f9ae244..58b418ed 100755 --- a/admin/Interface/RestaurarImagen +++ b/admin/Interface/RestaurarImagen @@ -8,8 +8,15 @@ # $4 Dirección IP del repositorio # $5 Protocolo UNICAST MULTICAST TORRENT # $6 Opciones del protocolo +#@version 1.2 - Soporta imágenes de disco. +#@author Irina Gomez, ETSII Universidad de Sevilla. +#@date 2020/06/22 #_______________________________________________________________________________________________________________________________ # Llamar al script de despliegue "deployImage". -deployImage "$4" "$3" "$1" "$2" "$5" "$6" "$7" "$8" || exit $? +if [ $2 -eq 0 ]; then + deployDiskImage "$4" "$3" "$1" "$5" "$6" "$7" "$8" || exit $? +else + deployImage "$4" "$3" "$1" "$2" "$5" "$6" "$7" "$8" || exit $? +fi diff --git a/admin/WebConsole/comandos/RestaurarImagen.php b/admin/WebConsole/comandos/RestaurarImagen.php index 21fdda46..21c5bf77 100644 --- a/admin/WebConsole/comandos/RestaurarImagen.php +++ b/admin/WebConsole/comandos/RestaurarImagen.php @@ -11,6 +11,9 @@ // HTMLSELECT_imagenes: Imagenes de todos los repositorios de la UO - Cambia parametro idordenadores por idambito // autor: Irina Gomez, Universidad de Sevilla // fecha 2015-06-17 +// Version 1.2: Soporta imágenes de disco. Nueva función HTMLSELECT_imagenes_disco +// Autora: Irina Gomez, ETSII Universidad de Sevilla +// Fecha: 2020-06-22 // ************************************************************************************************************************************************* include_once("../includes/ctrlacc.php"); include_once("../clases/AdoPhp.php"); @@ -200,6 +203,57 @@ function HTMLSELECT_imagenes($cmd,$idimagen,$numpar,$codpar,$icp,$sw,$idambito,$ $SelectHtml.= ''; return($SelectHtml); } +/*________________________________________________________________________________________________________ + Crea la etiqueta html '; + $SelectHtml.= ' '; + + if ($rs->Abrir()){ + $rs->Primero(); + while (!$rs->EOF){ + $SelectHtml.=''; + + $rs->Siguiente(); + } + $rs->Cerrar(); + } + $SelectHtml.= ''; + return($SelectHtml); +} + /*________________________________________________________________________________________________________ Crea la etiqueta html '.chr(13); + echo $TbMsg["DISK"].' '.$disk.chr(13); + echo '
'.$TbMsg["IMAGE_REPOSITORY"]." ".str_replace("despleimagen_","despleimagen_".$icp."_1",$select_imagenes).'
'.chr(13); + echo ''.chr(13); + echo ''.str_replace("protoclonacion_","protoclonacion_".$icp,$select_metodos).''.chr(13); + + // Tipo de tabla de particiones y tamaño. + $diskcodpar=isset($disktable[$tbKeys[$k]["codpar"]])? $disktable[$tbKeys[$k]["codpar"]] : ""; + $disksize=tomaTamano('0',$idordenadores,$tbKeys[$k]["numdisk"]); + + } else { $swcc=$tbKeys[$k]["clonable"]; if($swcc){ if ($tbKeys[$k]["tipopar"] == 'EFI') $disabled='disabled'; echo ''.chr(13); - echo '  '; $icp=$cc."_".$tbKeys[$k]["numdisk"]."_".$tbKeys[$k]["numpar"]; // Identificador de la configuración-partición echo ''.chr(13); echo ' '.$tbKeys[$k]["numpar"].' '.chr(13); @@ -264,28 +305,11 @@ function pintaParticionesRestaurarImagen($cmd,$configuraciones,$idordenadores,$c echo' '.tomaSistemasFicheros($tbKeys[$k]["numpar"],$idordenadores,false,$tbKeys[$k]["numdisk"]).' '.chr(13); echo' '.tomaTamano($tbKeys[$k]["numpar"],$idordenadores,$tbKeys[$k]["numdisk"]).' '.chr(13); if ($tbKeys[$k]["tipopar"] == 'EFI') { - echo "\n\n\n"; + echo "".chr(13); } else { - echo ''.HTMLSELECT_imagenes($cmd,$tbKeys[$k]["idimagen"],$tbKeys[$k]["numpar"],$tbKeys[$k]["codpar"],$icp,true,$idambito,$ambito).''; - echo ''.HTMLSELECT_imagenes($cmd,$tbKeys[$k]["idimagen"],$tbKeys[$k]["numpar"],$tbKeys[$k]["codpar"],$icp,false,$idambito,$ambito).''; - - //Clonación - $metodos="UNICAST=UNICAST-CACHE".chr(13); - $metodos.="UNICAST-DIRECT=UNICAST-DIRECT".chr(13); - $metodos.="MULTICAST " . mcast_syntax($cmd,$ambito,$idambito) . "=MULTICAST-CACHE".chr(13); - $metodos.="MULTICAST-DIRECT " . mcast_syntax($cmd,$ambito,$idambito) . "=MULTICAST-DIRECT".chr(13); - $metodos.="TORRENT " . torrent_syntax($cmd,$ambito,$idambito) . "=TORRENT-CACHE"; - - $TBmetodos["UNICAST-CACHE"]=1; - $TBmetodos["UNICAST-DIRECT"]=2; - $TBmetodos["MULTICAST-CACHE"]=3; - $TBmetodos["MULTICAST-DIRECT"]=4; - $TBmetodos["TORRENT-CACHE"]=5; - $idxc=$_SESSION["protclonacion"]; - if ($idxc == "UNICAST") { - $idxc = "UNICAST-DIRECT"; - } - echo ''.HTMLCTESELECT($metodos,"protoclonacion_".$icp,"estilodesple","",$TBmetodos[$idxc],100).''; + echo ''.HTMLSELECT_imagenes($cmd,$tbKeys[$k]["idimagen"],$tbKeys[$k]["numpar"],$tbKeys[$k]["codpar"],$icp,true,$idambito,$ambito).''.chr(13); + echo ''.HTMLSELECT_imagenes($cmd,$tbKeys[$k]["idimagen"],$tbKeys[$k]["numpar"],$tbKeys[$k]["codpar"],$icp,false,$idambito,$ambito).''.chr(13); + echo ''.HTMLCTESELECT($metodos,"protoclonacion_".$icp,"estilodesple","",$TBmetodos[$idxc],100).''.chr(13); } echo ''.chr(13); } @@ -293,8 +317,15 @@ function pintaParticionesRestaurarImagen($cmd,$configuraciones,$idordenadores,$c } } } + echo ''; + echo ''; + echo ' '.$diskcodpar.' '; + echo ''; + echo ' '.$disksize.' '; + echo ''; + echo ''.chr(13); } - echo ' '; + echo ' '.chr(13); } /*________________________________________________________________________________________________________ -- cgit v1.2.3-18-g5258