From c17ffa5d032a82e8eca61481dd8a8adb8b3fc5b1 Mon Sep 17 00:00:00 2001 From: albertogp Date: Tue, 4 May 2021 13:26:45 +0200 Subject: #1037 Add disk type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To help users choosing which preparation a computer needs according to its disk type, this commit: * Adds cloning engine support to retrieve disk type data from the computer when refreshing disks partition schema. * Adds WebConsole support to read disk type data from the database and show it on partition drawing. See also commits with #1037 in ogClient and ogServer repo. Co-authored-by: Javier Sánchez Parra --- admin/Interface/getConfiguration | 7 +++- admin/WebConsole/includes/pintaParticiones.php | 58 ++++++++++++++++++++++---- 2 files changed, 55 insertions(+), 10 deletions(-) (limited to 'admin') diff --git a/admin/Interface/getConfiguration b/admin/Interface/getConfiguration index ddfc3821..2173cca3 100755 --- a/admin/Interface/getConfiguration +++ b/admin/Interface/getConfiguration @@ -26,7 +26,9 @@ for ((dsk=1; dsk<=$disks; dsk++)); do *) ptt=0 ;; esac # Información de disco (partición 0) - cfg="$cfg$dsk:0:$ptt:::$(ogGetDiskSize $dsk):0;" + devpath=$(ogDiskToDev "$dsk") + dsktype=$(ogGetDiskType "$devpath") + cfg="$cfg$dsk:$dsktype:0:$ptt:::$(ogGetDiskSize $dsk):0;" for ((par=1;par<=$particiones;par++)); do # Código del identificador de tipo de partición cod=$(ogGetPartitionId $dsk $par 2>/dev/null) @@ -74,6 +76,9 @@ awk '{ n=split($0,sep,";"); c=split (sep[i],dua,":"); if (i==1 && c==1) printf ("ser=%s\n", dua[1]); + else if (c==8) + printf("disk=%s\tdtype=%s\tpar=%s\tcpt=%s\tfsi=%s\tsoi=%s\ttam=%s\tuso=%s\n", + dua[1],dua[2],dua[3],dua[4],dua[5],dua[6],dua[7],dua[8]); else printf ("disk=%s\tpar=%s\tcpt=%s\tfsi=%s\tsoi=%s\ttam=%s\tuso=%s\n", dua[1],dua[2],dua[3],dua[4],dua[5],dua[6],dua[7]); diff --git a/admin/WebConsole/includes/pintaParticiones.php b/admin/WebConsole/includes/pintaParticiones.php index 02c0f570..c789298d 100644 --- a/admin/WebConsole/includes/pintaParticiones.php +++ b/admin/WebConsole/includes/pintaParticiones.php @@ -2,6 +2,30 @@ include_once("../idiomas/php/".$idioma."/pintaParticiones_".$idioma.".php"); +function draw_disk_type($cmd, $computer_id, $disk) +{ + $cmd->texto = "SELECT disk_type " . + "FROM ordenadores_particiones " . + "WHERE idordenador=$computer_id " . + "AND numdisk=$disk " . + "AND numpar=0"; + + $rs = new Recordset; + $rs->Comando=&$cmd; + if (!$rs->Abrir()) return; + $rs->Primero(); + $disk_type = $rs->campos["disk_type"]; + syslog(LOG_ERR, print_r("test".$disk_type,true)); + + if ($disk_type=="NVM") + $html = ' - ( ' . $disk_type . + 'e )'; + else + $html = ' - ( ' . $disk_type . ' )'; + + return $html; +} + /** * Separa las distintas configuraciones de una cadena por disco. * Ej. 1;0;1@1;1;7@1;2;131@2;0;1@2;1;7 @@ -66,11 +90,15 @@ function pintaParticiones($cmd,$configuraciones,$idordenadores,$cc) $aviso=""; foreach($diskConfigs as $disk => $diskConfig){ $disk = (int)$disk; - echo''.chr(13); - echo ' '.$TbMsg["DISK"].' '.$disk.''.chr(13); + echo ''.chr(13); + + $html_disk_type = draw_disk_type($cmd, $idordenadores, $disk); + echo ' ' . + $TbMsg["DISK"] . ' ' . $disk . $html_disk_type . + ''.chr(13); - $auxCfg=explode("@",$diskConfig); // Crea lista de particiones for($i=0;$i $diskConfig){ $disk = (int)$disk; - echo''.chr(13); - echo ' '.$TbMsg["DISK"].' '.$disk.''.chr(13); - + + echo ''.chr(13); + + $html_disk_type = draw_disk_type($cmd, $idordenadores, $disk); + echo ' ' . + $TbMsg["DISK"] . ' ' . $disk . $html_disk_type . + ''.chr(13); + $auxCfg=explode("@",$diskConfig); // Crea lista de particiones for($i=0;$i $diskConfig){ $disk = (int)$disk; - echo''.chr(13); - echo ' '.$TbMsg["DISK"].' '.$disk.''.chr(13); - + + echo ''.chr(13); + + $html_disk_type = draw_disk_type($cmd, $idordenadores, $disk); + echo ' ' . + $TbMsg["DISK"] . ' ' . $disk . $html_disk_type . + ''.chr(13); + $auxCfg=explode("@",$diskConfig); // Crea lista de particiones for($i=0;$i