From e68f2816479eaffc76316d069bd2a83ef088591f Mon Sep 17 00:00:00 2001 From: bergware Date: Sat, 6 Nov 2021 00:05:25 +0100 Subject: [PATCH 01/14] VMs: automatically update virtio-win iso list --- plugins/dynamix.vm.manager/include/VMajax.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/dynamix.vm.manager/include/VMajax.php b/plugins/dynamix.vm.manager/include/VMajax.php index 0e60736b9..44337dcda 100644 --- a/plugins/dynamix.vm.manager/include/VMajax.php +++ b/plugins/dynamix.vm.manager/include/VMajax.php @@ -455,9 +455,9 @@ case 'virtio-win-iso-download': $strCleanCmd = '(chmod 777 '.escapeshellarg($_REQUEST['download_path']).' '.escapeshellarg($strTargetFile).'; chown nobody:users '.escapeshellarg($_REQUEST['download_path']).' '.escapeshellarg($strTargetFile).'; rm -f '.escapeshellarg($strMD5File).' '.escapeshellarg($strMD5StatusFile).')'; //$strCleanPgrep = '-f "chmod.*chown.*rm.*'.$strMD5StatusFile.'"'; $strAllCmd = "#!/bin/bash\n\n"; - $strAllCmd .= $strDownloadCmd.' >>'.escapeshellarg($strLogFile)." 2>$monitor && "; - $strAllCmd .= 'echo "'.$arrDownloadVirtIO['md5'].' '.$strTargetFile.'" >'.escapeshellarg($strMD5File).' && sleep 1 && '; - $strAllCmd .= $strVerifyCmd.' >'.escapeshellarg($strMD5StatusFile).' 2>/dev/null && sleep 2 && '; + $strAllCmd .= $strDownloadCmd.' >>'.escapeshellarg($strLogFile)." 2>$monitor && sleep 1 && "; + $strAllCmd .= 'echo "'.$arrDownloadVirtIO['md5'].' '.$strTargetFile.'" >'.escapeshellarg($strMD5File).' && sleep 2 && '; + $strAllCmd .= $strVerifyCmd.' >'.escapeshellarg($strMD5StatusFile).' 2>/dev/null && sleep 3 && '; $strAllCmd .= $strCleanCmd.' >>'.escapeshellarg($strLogFile).' 2>&1 && '; $strAllCmd .= 'rm -f '.escapeshellarg($strLogFile).' && '; $strAllCmd .= 'rm -f '.escapeshellarg($strInstallScript); From c6e376dc79da4a99e66b606e96b3db9e858190c3 Mon Sep 17 00:00:00 2001 From: bergware Date: Sat, 6 Nov 2021 00:15:31 +0100 Subject: [PATCH 02/14] VMs: automatically update virtio-win iso list --- plugins/dynamix.vm.manager/include/VMajax.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/dynamix.vm.manager/include/VMajax.php b/plugins/dynamix.vm.manager/include/VMajax.php index 44337dcda..547fcdd77 100644 --- a/plugins/dynamix.vm.manager/include/VMajax.php +++ b/plugins/dynamix.vm.manager/include/VMajax.php @@ -460,7 +460,8 @@ case 'virtio-win-iso-download': $strAllCmd .= $strVerifyCmd.' >'.escapeshellarg($strMD5StatusFile).' 2>/dev/null && sleep 3 && '; $strAllCmd .= $strCleanCmd.' >>'.escapeshellarg($strLogFile).' 2>&1 && '; $strAllCmd .= 'rm -f '.escapeshellarg($strLogFile).' && '; - $strAllCmd .= 'rm -f '.escapeshellarg($strInstallScript); + $strAllCmd .= 'rm -f '.escapeshellarg($strInstallScript).' && '; + $strAllCmd .= 'rm -f '.escapeshellarg($monitor); $arrResponse = []; if (file_exists($strTargetFile)) { if (!file_exists($strLogFile)) { @@ -513,13 +514,14 @@ case 'virtio-win-iso-download': } } } elseif (!$boolCheckOnly) { + @unlink($monitor); if (!pgrep($strInstallScriptPgrep, false)) { // Run all commands file_put_contents($strInstallScript, $strAllCmd); chmod($strInstallScript, 0777); exec($strInstallScript.' >/dev/null 2>&1 &'); } - $arrResponse['status'] = _('Downloading').$dots; + $arrResponse['status'] = _('Downloading').$dots.'0%'; } $arrResponse['pid'] = pgrep($strInstallScriptPgrep, false); } From cc180f90414f6c656631a747b89fe02f16e23dea Mon Sep 17 00:00:00 2001 From: bergware Date: Sat, 6 Nov 2021 00:39:44 +0100 Subject: [PATCH 03/14] VMs: automatically update virtio-win iso list --- plugins/dynamix.vm.manager/include/VMajax.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/dynamix.vm.manager/include/VMajax.php b/plugins/dynamix.vm.manager/include/VMajax.php index 547fcdd77..5db767ef8 100644 --- a/plugins/dynamix.vm.manager/include/VMajax.php +++ b/plugins/dynamix.vm.manager/include/VMajax.php @@ -445,7 +445,7 @@ case 'virtio-win-iso-download': // Save to /boot/config/domain.conf $domain_cfg['MEDIADIR'] = $_REQUEST['download_path']; $domain_cfg['VIRTIOISO'] = $strTargetFile; - $tmp = ''; $monitor = '/tmp/wget.monitor'; $dots = ' ... '; + $tmp = ''; $monitor = '/tmp/wget.monitor'; $dots = '... '; foreach ($domain_cfg as $key => $value) $tmp .= "$key=\"$value\"\n"; file_put_contents($domain_cfgfile, $tmp); $strDownloadCmd = 'wget -cO '.escapeshellarg($strTargetFile).' '.escapeshellarg($arrDownloadVirtIO['url']); @@ -476,8 +476,9 @@ case 'virtio-win-iso-download': } } else { if (pgrep($strDownloadPgrep, false)) { - // Get Download percent completed - $arrResponse['status'] = _('Downloading').$dots.exec("tail -2 $monitor|grep -Po '\d+%'"); + // Get Download progress and eta + [$done,$eta] = my_explode(' ',exec("tail -2 $monitor|awk 'NF==9 {print \$7,\$9;exit}'")); + $arrResponse['status'] = _('Downloading').$dots.$done.',  '._('ETA').': '.$eta; } elseif (pgrep($strVerifyPgrep, false)) { // Status = running md5 check $arrResponse['status'] = _('Verifying').$dots; From f63d7f2a417995501fe233d2beb6b566441dd59b Mon Sep 17 00:00:00 2001 From: bergware Date: Sat, 6 Nov 2021 00:49:43 +0100 Subject: [PATCH 04/14] VMs: automatically update virtio-win iso list --- plugins/dynamix.vm.manager/include/VMajax.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/dynamix.vm.manager/include/VMajax.php b/plugins/dynamix.vm.manager/include/VMajax.php index 5db767ef8..180926669 100644 --- a/plugins/dynamix.vm.manager/include/VMajax.php +++ b/plugins/dynamix.vm.manager/include/VMajax.php @@ -456,7 +456,7 @@ case 'virtio-win-iso-download': //$strCleanPgrep = '-f "chmod.*chown.*rm.*'.$strMD5StatusFile.'"'; $strAllCmd = "#!/bin/bash\n\n"; $strAllCmd .= $strDownloadCmd.' >>'.escapeshellarg($strLogFile)." 2>$monitor && sleep 1 && "; - $strAllCmd .= 'echo "'.$arrDownloadVirtIO['md5'].' '.$strTargetFile.'" >'.escapeshellarg($strMD5File).' && sleep 2 && '; + $strAllCmd .= 'echo "'.$arrDownloadVirtIO['md5'].' '.$strTargetFile.'" >'.escapeshellarg($strMD5File).' && sleep 3 && '; $strAllCmd .= $strVerifyCmd.' >'.escapeshellarg($strMD5StatusFile).' 2>/dev/null && sleep 3 && '; $strAllCmd .= $strCleanCmd.' >>'.escapeshellarg($strLogFile).' 2>&1 && '; $strAllCmd .= 'rm -f '.escapeshellarg($strLogFile).' && '; From 55b544b837d3634fac112447ebbef195cd7f50f1 Mon Sep 17 00:00:00 2001 From: bergware Date: Sat, 6 Nov 2021 01:08:35 +0100 Subject: [PATCH 05/14] VMs: automatically update virtio-win iso list --- plugins/dynamix.vm.manager/include/VMajax.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/dynamix.vm.manager/include/VMajax.php b/plugins/dynamix.vm.manager/include/VMajax.php index 180926669..e9b43ea40 100644 --- a/plugins/dynamix.vm.manager/include/VMajax.php +++ b/plugins/dynamix.vm.manager/include/VMajax.php @@ -422,17 +422,17 @@ case 'virtio-win-iso-download': $arrDownloadVirtIO = $virtio_isos[$strKeyName]; } if (empty($arrDownloadVirtIO)) { - $arrResponse = ['error' => 'Unknown version: '.$_REQUEST['download_version']]; + $arrResponse = ['error' => _('Unknown version').': '.$_REQUEST['download_version']]; } elseif (empty($_REQUEST['download_path'])) { - $arrResponse = ['error' => 'Specify a ISO storage path first']; + $arrResponse = ['error' => _('Specify a ISO storage path first')]; } elseif (!is_dir($_REQUEST['download_path'])) { - $arrResponse = ['error' => 'ISO storage path doesn\'t exist, please create the user share (or empty folder) first']; + $arrResponse = ['error' => _("ISO storage path doesn't exist, please create the user share (or empty folder) first")]; } else { @mkdir($_REQUEST['download_path'], 0777, true); $_REQUEST['download_path'] = realpath($_REQUEST['download_path']).'/'; // Check free space if (disk_free_space($_REQUEST['download_path']) < $arrDownloadVirtIO['size']+10000) { - $arrResponse['error'] = 'Not enough free space, need at least '.ceil($arrDownloadVirtIO['size']/1000000).'MB'; + $arrResponse['error'] = _('Not enough free space, need at least').' '.ceil($arrDownloadVirtIO['size']/1000000).'MB'; break; } $boolCheckOnly = !empty($_REQUEST['checkonly']); From a34ccfc688f17d4a936496c341c15e4890d45d53 Mon Sep 17 00:00:00 2001 From: bergware Date: Sat, 6 Nov 2021 01:16:21 +0100 Subject: [PATCH 06/14] VMs: automatically update virtio-win iso list --- plugins/dynamix.vm.manager/include/VMajax.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/dynamix.vm.manager/include/VMajax.php b/plugins/dynamix.vm.manager/include/VMajax.php index e9b43ea40..8b2a77e2e 100644 --- a/plugins/dynamix.vm.manager/include/VMajax.php +++ b/plugins/dynamix.vm.manager/include/VMajax.php @@ -459,9 +459,7 @@ case 'virtio-win-iso-download': $strAllCmd .= 'echo "'.$arrDownloadVirtIO['md5'].' '.$strTargetFile.'" >'.escapeshellarg($strMD5File).' && sleep 3 && '; $strAllCmd .= $strVerifyCmd.' >'.escapeshellarg($strMD5StatusFile).' 2>/dev/null && sleep 3 && '; $strAllCmd .= $strCleanCmd.' >>'.escapeshellarg($strLogFile).' 2>&1 && '; - $strAllCmd .= 'rm -f '.escapeshellarg($strLogFile).' && '; - $strAllCmd .= 'rm -f '.escapeshellarg($strInstallScript).' && '; - $strAllCmd .= 'rm -f '.escapeshellarg($monitor); + $strAllCmd .= 'rm -f '.escapeshellarg($strLogFile).' '.escapeshellarg($strInstallScript).' '.escapeshellarg($monitor); $arrResponse = []; if (file_exists($strTargetFile)) { if (!file_exists($strLogFile)) { From 31f26369432f480c86a0ea831d54bbf54d982b68 Mon Sep 17 00:00:00 2001 From: bergware Date: Sat, 6 Nov 2021 01:20:44 +0100 Subject: [PATCH 07/14] VMs: automatically update virtio-win iso list --- plugins/dynamix.vm.manager/include/Fedora-virtio-isos.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/dynamix.vm.manager/include/Fedora-virtio-isos.php b/plugins/dynamix.vm.manager/include/Fedora-virtio-isos.php index 8fdf6b91d..132e54a39 100644 --- a/plugins/dynamix.vm.manager/include/Fedora-virtio-isos.php +++ b/plugins/dynamix.vm.manager/include/Fedora-virtio-isos.php @@ -36,8 +36,8 @@ if (count($isos)>1) { $file = implode('-',$file); $virtio_isos[$iso]['name'] = "$iso.iso"; $virtio_isos[$iso]['url'] = "$archive/$iso/$file.iso"; - $virtio_isos[$iso]['size'] = 600*1024*1024; // assume 600 MB - $virtio_isos[$iso]['md5'] = ''; // unused md5 + $virtio_isos[$iso]['size'] = 600*1024*1024; // assume 600 MB - adjusted once file is downloaded + $virtio_isos[$iso]['md5'] = ''; // unused md5 - created once file is downloaded } // sort with newest version first uksort($virtio_isos,function($a,$b){return strnatcmp($b,$a);}); From 7f4eff5b57a30cf7885d13769e6dec77d8dcf5f8 Mon Sep 17 00:00:00 2001 From: bergware Date: Sat, 6 Nov 2021 02:02:22 +0100 Subject: [PATCH 08/14] VMs: automatically update virtio-win iso list --- plugins/dynamix.vm.manager/VMSettings.page | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/dynamix.vm.manager/VMSettings.page b/plugins/dynamix.vm.manager/VMSettings.page index d30d62321..53d9ccbd9 100644 --- a/plugins/dynamix.vm.manager/VMSettings.page +++ b/plugins/dynamix.vm.manager/VMSettings.page @@ -120,7 +120,7 @@ _(Libvirt vdisk size)_: :vms_libvirt_vdisk_size_help: _(Libvirt storage location)_: -: +: _(Modify with caution: unable to validate path until Array is Started)_ _(Path does not exist)_ @@ -130,14 +130,14 @@ _(Libvirt storage location)_: _(Default VM storage path)_: -: +: _(Modify with caution: unable to validate path until Array is Started)_ _(Path does not exist)_ :vms_libvirt_storage_help: _(Default ISO storage path)_: -: +: _(Modify with caution: unable to validate path until Array is Started)_ _(Path does not exist)_ @@ -404,9 +404,9 @@ $(function(){ $("#IMAGE_FILE").fileTreeAttach(null, null, function(folder) { $("#IMAGE_FILE").val(folder + 'libvirt.img').change(); }); - $("#domaindir").fileTreeAttach(); - $("#mediadir").fileTreeAttach(); - $("#winvirtio").fileTreeAttach(); + $('#domaindir').fileTreeAttach(); + $('#mediadir').fileTreeAttach(); + $('#winvirtio').fileTreeAttach(); if ($("#IMAGE_FILE").length) { $("#IMAGE_FILE").on("input change", function(){ From 4cdc7f8937dfb9ba0552a62d252b7179e8482c11 Mon Sep 17 00:00:00 2001 From: bergware Date: Sat, 6 Nov 2021 02:49:44 +0100 Subject: [PATCH 09/14] Revert "Remove unused uptime update" This reverts commit 5ea9245e05179bd98c65e347063e9822b2bfdee0. --- plugins/dynamix/include/DefaultPageLayout.php | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/dynamix/include/DefaultPageLayout.php b/plugins/dynamix/include/DefaultPageLayout.php index 27b0f1582..f52b08b64 100644 --- a/plugins/dynamix/include/DefaultPageLayout.php +++ b/plugins/dynamix/include/DefaultPageLayout.php @@ -125,6 +125,7 @@ function updateTime() { var days = parseInt(uptime/86400); var hour = parseInt(uptime/3600%24); var mins = parseInt(uptime/60%60); + $('span.uptime').html(((days|hour|mins)?plus(days,"","",(hour|mins)==0)+plus(hour,"","",mins==0)+plus(mins,"","",true):"")); uptime += Math.round((now.getTime() - before.getTime())/1000); before = now; if (expiretime > 0) { From ece0e27e5b7daec16aa6b87ec7e16d1448a46030 Mon Sep 17 00:00:00 2001 From: bergware Date: Sat, 6 Nov 2021 08:00:03 +0100 Subject: [PATCH 10/14] VMs: automatically update virtio-win iso list --- plugins/dynamix.vm.manager/VMSettings.page | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/dynamix.vm.manager/VMSettings.page b/plugins/dynamix.vm.manager/VMSettings.page index 53d9ccbd9..4461a8125 100644 --- a/plugins/dynamix.vm.manager/VMSettings.page +++ b/plugins/dynamix.vm.manager/VMSettings.page @@ -56,6 +56,7 @@ $pcie_acs_override = detect($syslinux, 'pcie_acs_override'); $vfio_allow_unsafe = detect($syslinux, 'allow_unsafe_interrupts'); $bgcolor = strstr('white,azure',$display['theme']) ? '#f2f2f2' : '#1c1c1c'; $started = $var['fsState']=='Started'; +$libvirt_up = $libvirt_running=='yes'; ?> @@ -99,7 +100,7 @@ _(Enable VMs)_:
- + get_connect_information()?> _(Libvirt version)_: @@ -115,7 +116,7 @@ _(Libvirt storage location)_: _(Libvirt vdisk size)_: -: _(GB)_ +: _(GB)_ :vms_libvirt_vdisk_size_help: @@ -209,7 +210,7 @@ _(VFIO allow unsafe interrupts)_: - +
_(Libvirt volume info)_
_(btrfs filesystem show)_: @@ -243,7 +244,7 @@ _(btrfs scrub status)_:
- +
@@ -254,7 +255,7 @@ _(btrfs scrub status)_: