From bde58c02984610779a3fa49046663a6db7772452 Mon Sep 17 00:00:00 2001 From: SimonFair <39065407+SimonFair@users.noreply.github.com> Date: Mon, 16 Oct 2023 13:24:54 +0100 Subject: [PATCH] Revise processing --- .../dynamix.vm.manager/include/libvirt.php | 35 +++++-------------- .../templates/Custom.form.php | 11 ++---- 2 files changed, 11 insertions(+), 35 deletions(-) diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php index ed8f1d77e..0cb19f8f1 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php @@ -268,6 +268,7 @@ function config_to_xml($config,$vmclone = false) { + file_put_contents("/tmp/vmconfig", $config) ; $domain = $config['domain']; $media = $config['media']; $nics = $config['nic']; @@ -732,12 +733,7 @@ $pcidevs=''; $gpudevs_used=[]; - $multidevices = $multi = [] ; #Load? - foreach ($gpus as $i => $gpu) { - if ($gpu['guestbus'] != "") $multi[$gpu['guestbus']] = $gpu['guestbus'] ; - #$multi[$gpu['guestbus']] = $gpu['guestbus'] ; - } - ksort($multi) ; + $multidevices = [] ; #Load? $vmrc=''; $channelscopypaste = ''; if (!empty($gpus)) { @@ -841,22 +837,8 @@ } if ($gpu['multi'] == "on"){ - if ($gpu['guestbus'] == "") { - # This is a new Multifunction device/VM allocate from range 0x90 - $multibus = array_key_last($multi) ; - if ($multibus == NULL) $multi_bus = "0x90" ; - else - { - $multi_bus = hexdec($multibus) + 1 ; - $multi_bus = "0x".dechex($multi_bus) ; - } - $multi[$multi_bus] = $multi_bus ; - $strSpecialAddress = "
" ; - } else { - $multi_bus = $gpu['guestbus'] ; - $strSpecialAddress = "
" ; - } - $multidevices[$gpu_bus] = $multi_bus ; + $strSpecialAddress = "
" ; + $multidevices[$gpu_bus] = "0x$gpu_bus" ; } @@ -873,7 +855,8 @@ $gpudevs_used[] = $gpu['id']; } } - file_put_contents("/tmp/bus", $multi) ; + #file_put_contents("/tmp/pcidevs" , $pcidevs) ; + #file_put_contents("/tmp/bus", $multidevices) ; $audiodevs_used=[]; $strSpecialAddressAudio = "" ; if (!empty($audios)) { @@ -885,7 +868,7 @@ [$audio_bus, $audio_slot, $audio_function] = my_explode(":", str_replace('.', ':', $audio['id']), 3); if ($audio_function != 0) { - if (isset($multidevices[$audio_bus])) $strSpecialAddressAudio = "
" ; + if (isset($multidevices[$audio_bus])) $strSpecialAddressAudio = "
" ; } $pcidevs .= " @@ -919,8 +902,7 @@
- - $strSpecialAddressOther " ; + " ; if (!empty($pciboot[$pci_id]) && !$vmclone) { $pcidevs .= "" ; @@ -933,6 +915,7 @@ if ($vmclone) $pcidevs_used[] = $pci_id['d']; else $pcidevs_used[] = $pci_id ; } } + #file_put_contents("/tmp/vmdetail", $pcidevs) ; $memballoon = ""; if (empty( array_filter(array_merge($gpudevs_used, $audiodevs_used, $pcidevs_used), function($k){ return strpos($k,'#remove')===false && $k!='virtual' ; }) )) { diff --git a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php index 53881ce21..939d352ed 100644 --- a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php +++ b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php @@ -996,7 +996,6 @@ echo mk_option($arrGPU['guest']['multi'], 'on', 'On'); ?> - "> @@ -1134,19 +1133,13 @@ } ?> - - >_(Multifunction)_: - - -