diff --git a/plugins/dynamix.vm.manager/VMMachines.page b/plugins/dynamix.vm.manager/VMMachines.page index f04163048..06825e1bc 100644 --- a/plugins/dynamix.vm.manager/VMMachines.page +++ b/plugins/dynamix.vm.manager/VMMachines.page @@ -129,8 +129,8 @@ if ($action) { Description CPUs Memory - Hard Drives - VNC Port + vDisks + Graphics Autostart @@ -158,12 +158,13 @@ if ($action) { $id = $lv->domain_get_id($res); $is_autostart = $lv->domain_get_autostart($res); $state = $lv->domain_state_translate($dom['state']); + $arrConfig = domain_to_config($uuid); if ($state == 'running') { $mem = $dom['memory'] / 1024; }else{ $mem = $lv->domain_get_memory($res)/1024; } - $mem = number_format($mem, 0); + $mem = round($mem).'M'; $vcpu = $dom['nrVirtCpu']; $auto = $is_autostart ? 'checked="checked"':""; $template = $lv->_get_single_xpath_result($res, '//domain/metadata/*[local-name()=\'vmtemplate\']/@name'); @@ -182,11 +183,23 @@ if ($action) { $vncport = $lv->domain_get_vnc_port($res); $vnc = ''; + $graphics = ''; if ($vncport > 0) { - $wsport = $lv->domain_get_ws_port($res); - $vnc = '/plugins/dynamix.vm.manager/vnc.html?autoconnect=true&host=' . $_SERVER['HTTP_HOST'] . '&port=' . $wsport . '&path='; - } else { - $vncport = ($vncport < 0) ? "auto" : ""; + $wsport = $lv->domain_get_ws_port($res); + $vnc = '/plugins/dynamix.vm.manager/vnc.html?autoconnect=true&host=' . $_SERVER['HTTP_HOST'] . '&port=' . $wsport . '&path='; + $graphics = 'VNC:'.$vncport; + } else if ($vncport == -1) { + $graphics = 'VNC:auto'; + } else if (!empty($arrConfig['gpu'])) { + $arrValidGPUDevices = getValidGPUDevices(); + foreach($arrConfig['gpu'] as $arrGPU) { + foreach($arrValidGPUDevices as $arrDev) { + if ($arrGPU['id'] == $arrDev['id']) { + $graphics .= $arrDev['name']."\n"; + } + } + } + $graphics = str_replace("\n", "
", trim($graphics)); } $bootdev = $lv->domain_get_boot_devices($res)[0]; @@ -208,7 +221,7 @@ if ($action) { $vcpu $mem $disks - $vncport + $graphics "; echo " diff --git a/plugins/dynamix.vm.manager/classes/libvirt.php b/plugins/dynamix.vm.manager/classes/libvirt.php index f0b4b668c..3190170cb 100644 --- a/plugins/dynamix.vm.manager/classes/libvirt.php +++ b/plugins/dynamix.vm.manager/classes/libvirt.php @@ -1102,7 +1102,7 @@ } unset($tmp); - return $this->format_size($ret, 2, $unit); + return $this->format_size($ret, 0, $unit); } function get_disk_count($domain) { @@ -1139,11 +1139,11 @@ $unit = strtoupper($unit); switch ($unit) { - case 'T': return number_format($value / (float)1099511627776, $decimals).' TB'; - case 'G': return number_format($value / (float)(1 << 30), $decimals).' GB'; - case 'M': return number_format($value / (float)(1 << 20), $decimals).' MB'; - case 'K': return number_format($value / (float)(1 << 10), $decimals).' KB'; - case 'B': return $value.' B'; + case 'T': return number_format($value / (float)1099511627776, $decimals).'T'; + case 'G': return number_format($value / (float)(1 << 30), $decimals).'G'; + case 'M': return number_format($value / (float)(1 << 20), $decimals).'M'; + case 'K': return number_format($value / (float)(1 << 10), $decimals).'K'; + case 'B': return $value.'B'; } return false;