From 9ae15014b1e80f0fe9363119a0b16f2754980773 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Fri, 3 Sep 2021 10:24:52 +0200 Subject: #1062 Support tiptorrent image transfer mode Add support for tiptorrent image transfer mode to client's bash scripts (aka cloning engine). If desired, clients receive images to restore with the new unicast transfer mode tiptorrent. See also: http://git.soleta.eu/tiptorrent/ #1062 Add tiptorrent support to WebConsole Add tiptorrent option to WebConsole restore image form. #1062 Launch tiptorrent on oglive init This commit adds tiptorrent launch to oglive init process. Clients launch tiptorrent daemon if they have cache partition. #1062 Fix minor tiptorrent integration bugs * Fix md5sum pipe typo * Use correct variable for checksum download #1062 Calculate checksum on image creation Otherwise, OpenGnsys depends on cron and bittorrent specific scripts to obtain images checksums. Support cache cleaning for tiptorrent image parts Tiptorrent downloads and saves images to the cache in parts. With this commit, WebConsole shows and deletes all parts as one. #1062 Rename TIPTORRENT-CACHE in restore image form This commit changes TIPTORRENT for TIPTORRENT-CACHE to keep naming consistency. #1062 tiptorrent stores whole file instead of chunks Tiptorrent now stores the whole file instead of the split chunks. Removes any chunk related code from cloning engine scripts. Requires newer version of tiptorrent installed (tiptorrent-static >= 1.0.0-6). Always compute MD5 of cached image Do not rely on MD5 checksum file from the cache on tiptorrent transfers. Otherwise, cloning engine could restore a corrupted image. #1062 Check tiptorrent exit code Otherwise, the image restoration continues in failed downloads. --- admin/WebConsole/comandos/EliminarImagenCache.php | 4 ++++ admin/WebConsole/includes/pintaParticiones.php | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'admin') diff --git a/admin/WebConsole/comandos/EliminarImagenCache.php b/admin/WebConsole/comandos/EliminarImagenCache.php index 6c9e92ba..60a24cea 100644 --- a/admin/WebConsole/comandos/EliminarImagenCache.php +++ b/admin/WebConsole/comandos/EliminarImagenCache.php @@ -348,6 +348,10 @@ switch($ambito){ $ima[$x] = str_replace(".img.diff", "", $ima[$x]); //quitar todos los .img $ima[$x]=trim($ima[$x]); $nombreimagenes[]="f-".$ima[$x]; + } elseif (preg_match("/\.[0-3]/", $ima[$x])) { + $ima[$x] = preg_replace("/\.img\.[0-3]/", "", $ima[$x]); + $ima[$x] = trim($ima[$x]); + $nombreimagenes[] = "f-".$ima[$x]; }else{ $ima[$x] = str_replace(".img", "", $ima[$x]); //quitar todos los .img $ima[$x]=trim($ima[$x]); diff --git a/admin/WebConsole/includes/pintaParticiones.php b/admin/WebConsole/includes/pintaParticiones.php index c789298d..ef70de44 100644 --- a/admin/WebConsole/includes/pintaParticiones.php +++ b/admin/WebConsole/includes/pintaParticiones.php @@ -308,13 +308,15 @@ function pintaParticionesRestaurarImagen($cmd,$configuraciones,$idordenadores,$c $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"; + $metodos.="TORRENT " . torrent_syntax($cmd,$ambito,$idambito) . "=TORRENT-CACHE".chr(13); + $metodos.="TIPTORRENT=TIPTORRENT-CACHE"; $TBmetodos["UNICAST-CACHE"]=1; $TBmetodos["UNICAST-DIRECT"]=2; $TBmetodos["MULTICAST-CACHE"]=3; $TBmetodos["MULTICAST-DIRECT"]=4; $TBmetodos["TORRENT-CACHE"]=5; + $TBmetodos["TIPTORRENT"]=6; $idxc=$_SESSION["protclonacion"]; if ($idxc == "UNICAST") { $idxc = "UNICAST-DIRECT"; -- cgit v1.2.3-18-g5258