From 79ddabe5d44ba16eb222ffcbc92ab166a3ec9bd0 Mon Sep 17 00:00:00 2001 From: bergware Date: Tue, 27 Mar 2018 12:40:03 +0200 Subject: [PATCH] VMmachine updates - changed DETACH is available when VM is running - default bus to VirtIO - minor layout changes --- .../dynamix.vm.manager/include/VMMachines.php | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/plugins/dynamix.vm.manager/include/VMMachines.php b/plugins/dynamix.vm.manager/include/VMMachines.php index 4ddedd90a..da04c70eb 100644 --- a/plugins/dynamix.vm.manager/include/VMMachines.php +++ b/plugins/dynamix.vm.manager/include/VMMachines.php @@ -104,10 +104,10 @@ foreach ($vms as $vm) { foreach ($lv->get_disk_stats($res) as $arrDisk) { $capacity = $lv->format_size($arrDisk['capacity'], 0); $allocation = $lv->format_size($arrDisk['allocation'], 0); - $disk = array_key_exists('file', $arrDisk) ? $arrDisk['file'] : $arrDisk['partition']; + $disk = $arrDisk['file'] ?? $arrDisk['partition']; $dev = $arrDisk['device']; - $bus = $arrDisk['bus']; - echo "$disk{$arrValidDiskBuses[$bus]}"; + $bus = $arrValidDiskBuses[$arrDisk['bus']] ?? 'VirtIO'; + echo "$disk$bus"; if ($state == 'shutoff') { echo ""; echo "
"; @@ -119,12 +119,10 @@ foreach ($vms as $vm) { echo "$capacity"; echo ""; echo "
"; - echo "$allocation"; - echo "detach from VM: $vm',type:'warning',html:'true',showCancelButton:true},function(){\$('div.spinner').show('slow');setTimeout(function(){ajaxVMDispatch({action:'disk-remove',uuid:'$uuid',dev:'$dev'},'loadlist');},100);})\" title='detach disk from VM'>"; } else { - echo "$capacity$allocationN/A"; + echo "$capacity"; } - echo ""; + echo "$allocation locked"; } /* end Display VM disks */ @@ -132,15 +130,15 @@ foreach ($vms as $vm) { foreach ($lv->get_cdrom_stats($res) as $arrCD) { $capacity = $lv->format_size($arrCD['capacity'], 0); $allocation = $lv->format_size($arrCD['allocation'], 0); - $disk = (array_key_exists('file', $arrCD)) ? $arrCD['file'] : $arrCD['partition']; + $disk = $arrCD['file'] ?? $arrCD['partition']; $dev = $arrCD['device']; - $bus = $arrCD['bus']; - echo "$disk{$arrValidDiskBuses[$bus]}$capacity$allocation"; + $bus = $arrValidDiskBuses[$arrCD['bus']] ?? 'VirtIO'; + echo "$disk$bus$capacity$allocation"; if ($state == 'shutoff') - echo "detach from VM: $vm',type:'warning',html:'true',showCancelButton:true},function(){\$('div.spinner').show('slow');setTimeout(function(){ajaxVMDispatch({action:'disk-remove',uuid:'$uuid',dev:'$dev'},'loadlist');},100);})\" title='detach disk from VM'>"; + echo " locked "; else - echo "N/A"; - echo ""; + echo "from VM: $vm',type:'warning',html:true,showCancelButton:true},function(){\$('div.spinner').show('slow');setTimeout(function(){ajaxVMDispatch({action:'disk-remove',uuid:'$uuid',dev:'$dev'},'loadlist');},100);})\" title='detach disk from VM'> detach"; + echo ""; } /* end Display VM cdroms */