diff --git a/plugins/dynamix.vm.manager/include/libvirt.php b/plugins/dynamix.vm.manager/include/libvirt.php
index 0916bda78..8e51dc7a2 100644
--- a/plugins/dynamix.vm.manager/include/libvirt.php
+++ b/plugins/dynamix.vm.manager/include/libvirt.php
@@ -279,6 +279,7 @@
$pae = ($arch == 'i686') ? '' : '';
$loader = '';
+ $swtpm = '';
if (!empty($domain['ovmf'])) {
if ($domain['ovmf'] == 1) {
if (!is_file('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi.fd')) {
diff --git a/plugins/dynamix.vm.manager/include/libvirt_helpers.php b/plugins/dynamix.vm.manager/include/libvirt_helpers.php
index 825e09b3e..9031d29f1 100644
--- a/plugins/dynamix.vm.manager/include/libvirt_helpers.php
+++ b/plugins/dynamix.vm.manager/include/libvirt_helpers.php
@@ -1049,14 +1049,14 @@
$strUSBMode = 'usb3-qemu';
}
+ $strOVMF = '0';
if (!empty($lv->domain_get_ovmf($res))) {
- if (is_file('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi.fd')) {
+ $ovmfloader = $lv->domain_get_ovmf($res);
+ if (strpos($ovmfloader, '_CODE-pure-efi.fd') !== false) {
$strOVMF = '1';
- } else if (is_file('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi-tpm.fd')) {
+ } else if (strpos($ovmfloader, '_CODE-pure-efi-tpm.fd') !== false) {
$strOVMF = '2';
- } else {
- $strOVMF = '0';
- }
+ }
}
return [
@@ -1148,8 +1148,10 @@
// update parent arrays
if (!$old['devices']['hostdev']) unset($old['devices']['hostdev']);
if (!$new['devices']['hostdev']) unset($new['devices']['hostdev']);
+ // preserve tpm
+ if (!$new['devices']['tpm']) unset($old['devices']['tpm']);
// remove existing auto-generated settings
- unset($old['cputune']['vcpupin'],$old['devices']['video'],$old['devices']['disk'],$old['devices']['interface'],$old['cpu']['@attributes'],$old['os']['boot']);
+ unset($old['cputune']['vcpupin'],$old['devices']['video'],$old['devices']['disk'],$old['devices']['interface'],$old['cpu']['@attributes'],$old['os']['boot'],$old['os']['loader'],$old['os']['nvram']);
// set namespace
$new['metadata']['vmtemplate']['@attributes']['xmlns'] = 'unraid';
}
diff --git a/plugins/dynamix.vm.manager/templates/Custom.form.php b/plugins/dynamix.vm.manager/templates/Custom.form.php
index 0cd71e96c..5c56c315b 100644
--- a/plugins/dynamix.vm.manager/templates/Custom.form.php
+++ b/plugins/dynamix.vm.manager/templates/Custom.form.php
@@ -429,9 +429,6 @@
}
?>
-
-
- }?>
@@ -1389,10 +1386,10 @@ $(function() {
$("#vmform #domain_ovmf").change(function changeBIOSEvent() {
// using OVMF - disable vmvga vnc option
- if ($(this).val() == '1' && $("#vmform #vncmodel").val() == 'vmvga') {
+ if ($(this).val() != '0' && $("#vmform #vncmodel").val() == 'vmvga') {
$("#vmform #vncmodel").val('qxl');
}
- $("#vmform #vncmodel option[value='vmvga']").prop('disabled', ($(this).val() == '1'));
+ $("#vmform #vncmodel option[value='vmvga']").prop('disabled', ($(this).val() != '0'));
}).change(); // fire event now
$("#vmform").on("spawn_section", function spawnSectionEvent(evt, section, sectiondata) {