From 72ff3c52c0b3045e9753f8fcc81628b577dc8811 Mon Sep 17 00:00:00 2001 From: SimonFair <39065407+SimonFair@users.noreply.github.com> Date: Thu, 22 Aug 2024 23:24:18 +0100 Subject: [PATCH] Unmap Default and Multifuncton Set default for new VMs to discard="unmap" Fix BSOD for VMs and Multifunction. --- .../dynamix.vm.manager/include/libvirt.php | 24 +++++++++++++------ .../templates/Custom.form.php | 2 +- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php index 0b8fc1496..577c33fea 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php @@ -267,6 +267,9 @@ if (!empty($disk['serial'])) { $arrReturn['serial'] = $disk['serial']; } + if (!empty($disk['discard'])) { + $arrReturn['discard'] = $disk['discard']; + } } } @@ -907,10 +910,17 @@ } if ($gpu['multi'] == "on"){ - $newgpu_bus = dechex(hexdec($gpu_bus) + 0x20) ; + $newgpu_bus= 0x10; + if (!isset($multibus[$newgpu_bus])) { + $multibus[$newgpu_bus] = 0x10; + } else { + #Get next bus + $newgpu_bus = end($multibus) + 0x01; + $multibus[$newgpu_bus] = $newgpu_bus; + } if ($machine_type == "pc") $newgpu_slot = "0x01" ; else $newgpu_slot = "0x00" ; - $strSpecialAddress = "
" ; - $multidevices[$gpu_bus] = "0x$gpu_bus" ; + $strSpecialAddress = "" ; + $multidevices[$gpu_bus] = $newgpu_bus ; } @@ -939,9 +949,9 @@ [$audio_bus, $audio_slot, $audio_function] = my_explode(":", str_replace('.', ':', $audio['id']), 3); if ($audio_function != 0) { if (isset($multidevices[$audio_bus])) { - $newaudio_bus = dechex(hexdec($audio_bus) + 0x20) ; + $newaudio_bus = $multidevices[$audio_bus] ; if ($machine_type == "pc") $newaudio_slot = "0x01" ; else $newaudio_slot = "0x00" ; - $strSpecialAddressAudio = "" ; + $strSpecialAddressAudio = "" ; } } @@ -970,9 +980,9 @@ if ($pci_function != 0) { if (isset($multidevices[$pci_bus])) { - $newpci_bus = dechex(hexdec($pci_bus) + 0x20) ; + $newpci_bus = $multidevices[$pci_bus]; if ($machine_type == "pc") $newpci_slot = "0x01" ; else $newpci_slot = "0x00" ; - $strSpecialAddressOther = "" ; + $strSpecialAddressOther = "" ; } } diff --git a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php index 930d2eb18..26b31c440 100644 --- a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php +++ b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php @@ -90,7 +90,7 @@ 'bus' => 'virtio' , 'boot' => 1, 'serial' => 'vdisk1', - 'discard' => 'ignore' + 'discard' => 'unmap' ] ], 'gpu' => [