mirror of
https://github.com/unraid/webgui.git
synced 2026-01-09 11:10:29 -06:00
Merge pull request #1905 from SimonFair/Add-additional-checks-to-vm_dashusage
Update vm_dashusage
This commit is contained in:
@@ -12,17 +12,43 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
function get_libvird_status() {
|
||||
$dummy = array();
|
||||
exec("/etc/rc.d/rc.libvirt status >/dev/null",$dummy,$libvirtd);
|
||||
$libvirtd = $libvirtd==0;
|
||||
return $libvirtd;
|
||||
}
|
||||
|
||||
$docroot = '/usr/local/emhttp';
|
||||
$varroot = '/var/local/emhttp';
|
||||
$md5_old = -1;
|
||||
|
||||
require_once "$docroot/webGui/include/Helpers.php";
|
||||
require_once "$docroot/webGui/include/publish.php";
|
||||
global $vmusagestats,$var;
|
||||
$domain_cfgfile = "/boot/config/domain.cfg";
|
||||
$domain_cfg = parse_ini_file($domain_cfgfile);
|
||||
if (!isset($var)){
|
||||
$var = @parse_ini_file("$docroot/state/var.ini");
|
||||
}
|
||||
|
||||
# Check if array started
|
||||
if ($var['fsState'] == "Started" || $var['fsState'] == "Starting") {
|
||||
if (!get_libvird_status() && $domain_cfg['SERVICE'] == "enable") {
|
||||
while(!get_libvird_status()) {
|
||||
sleep(10);
|
||||
}
|
||||
sleep(10);
|
||||
} elseif ($domain_cfg['SERVICE'] != "enable") {
|
||||
#Add remove_nchan_pid_entry("webGui/nchan/vm_dashusage");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
#Add remove_nchan_pid_entry("webGui/nchan/vm_dashusage");
|
||||
return;
|
||||
}
|
||||
|
||||
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();
|
||||
@@ -54,8 +80,6 @@ function update_translation($locale) {
|
||||
}
|
||||
}
|
||||
|
||||
$domain_cfgfile = "/boot/config/domain.cfg";
|
||||
$domain_cfg = parse_ini_file($domain_cfgfile);
|
||||
if (isset($domain_cfg['USAGE']) && $domain_cfg['USAGE'] != 'Y' ) return;
|
||||
if (!isset($domain_cfg['USAGETIMER'])) $timer = 3 ; else $timer = $domain_cfg['USAGETIMER'];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user