Merge pull request #1697 from SimonFair/VM-Metrics

Fix php error due to typo and if libvirt is not started.
This commit is contained in:
tom mortensen
2024-04-08 13:14:25 -07:00
committed by GitHub
4 changed files with 8 additions and 4 deletions
@@ -165,7 +165,7 @@ if ($_POST['vms']) {
echo $vmhtml;
}
if (!count($vmusagehtml)) echo "<span id='no_usagevms'><br> "._('No running virtual machines')."<br></span>";
if ($running < 1 && count($vmsusagehtml)) echo "<span id='no_usagevms'><br>". _('No running virtual machines')."<br></span>";
if ($running < 1 && count($vmusagehtml)) echo "<span id='no_usagevms'><br>". _('No running virtual machines')."<br></span>";
echo "</td></tr>";
}
}
@@ -20,6 +20,10 @@ require_once "$docroot/webGui/include/Helpers.php";
require_once "$docroot/webGui/include/publish.php";
require_once "$docroot/plugins/dynamix.vm.manager/include/libvirt_helpers.php";
global $vmusagestats;
exec("/etc/rc.d/rc.libvirt status >/dev/null",$dummy,$libvirtd);
$libvirtd = $libvirtd==0;
if (!$libvirtd) return;
extract(parse_plugin_cfg('dynamix',true));
get_vm_usage_stats();
sleep(1);