mirror of
https://github.com/unraid/webgui.git
synced 2026-02-11 03:28:46 -06:00
Merge pull request #959 from ich777/master
added Windows 11 template and OVMF TPM
This commit is contained in:
@@ -280,15 +280,32 @@
|
||||
|
||||
$loader = '';
|
||||
if (!empty($domain['ovmf'])) {
|
||||
if (!is_file('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi.fd')) {
|
||||
// Create a new copy of OVMF VARS for this VM
|
||||
mkdir('/etc/libvirt/qemu/nvram/', 0777, true);
|
||||
copy('/usr/share/qemu/ovmf-x64/OVMF_VARS-pure-efi.fd', '/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi.fd');
|
||||
}
|
||||
if ($domain['ovmf'] == 1) {
|
||||
if (!is_file('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi.fd')) {
|
||||
// Create a new copy of OVMF VARS for this VM
|
||||
mkdir('/etc/libvirt/qemu/nvram/', 0777, true);
|
||||
copy('/usr/share/qemu/ovmf-x64/OVMF_VARS-pure-efi.fd', '/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi.fd');
|
||||
}
|
||||
|
||||
$loader = "<loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
|
||||
<nvram>/etc/libvirt/qemu/nvram/".$uuid."_VARS-pure-efi.fd</nvram>";
|
||||
}
|
||||
if ($domain['ovmf'] == 2) {
|
||||
if (!is_file('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi-tpm.fd')) {
|
||||
// Create a new copy of OVMF VARS for this VM
|
||||
mkdir('/etc/libvirt/qemu/nvram/', 0777, true);
|
||||
copy('/usr/share/qemu/ovmf-x64/OVMF_VARS-pure-efi-tpm.fd', '/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi-tpm.fd');
|
||||
}
|
||||
|
||||
$loader = "<loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi-tpm.fd</loader>
|
||||
<nvram>/etc/libvirt/qemu/nvram/".$uuid."_VARS-pure-efi-tpm.fd</nvram>";
|
||||
|
||||
$swtpm = "<tpm model='tpm-tis'>
|
||||
<backend type='emulator' version='2.0'/>
|
||||
</tpm>";
|
||||
}
|
||||
}
|
||||
|
||||
$loader = "<loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
|
||||
<nvram>/etc/libvirt/qemu/nvram/".$uuid."_VARS-pure-efi.fd</nvram>";
|
||||
}
|
||||
|
||||
$metadata = '';
|
||||
if (!empty($template)) {
|
||||
@@ -792,6 +809,7 @@
|
||||
<channel type='unix'>
|
||||
<target type='virtio' name='org.qemu.guest_agent.0'/>
|
||||
</channel>
|
||||
$swtpm
|
||||
$memballoon
|
||||
</devices>
|
||||
</domain>";
|
||||
@@ -1626,6 +1644,9 @@
|
||||
if (is_file('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi.fd')) {
|
||||
unlink('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi.fd');
|
||||
}
|
||||
if (is_file('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi-tpm.fd')) {
|
||||
unlink('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi-tpm.fd');
|
||||
}
|
||||
|
||||
$tmp = libvirt_domain_undefine($dom);
|
||||
return ($tmp) ? $tmp : $this->_set_last_error();
|
||||
@@ -1667,6 +1688,10 @@
|
||||
rename('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi.fd', '/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi.fd_backup');
|
||||
return true;
|
||||
}
|
||||
if (is_file('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi-tpm.fd')) {
|
||||
rename('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi-tpm.fd', '/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi-tpm.fd_backup');
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1677,6 +1702,10 @@
|
||||
rename('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi.fd_backup', '/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi.fd');
|
||||
return true;
|
||||
}
|
||||
if (is_file('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi-tpm.fd_backup')) {
|
||||
rename('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi-tpm.fd_backup', '/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi-tpm.fd');
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,24 @@
|
||||
$arrAllTemplates = [
|
||||
' Windows ' => '', /* Windows Header */
|
||||
|
||||
'Windows 11' => [
|
||||
'form' => 'Custom.form.php',
|
||||
'icon' => 'windows11.png',
|
||||
'os' => 'windowstpm',
|
||||
'overrides' => [
|
||||
'domain' => [
|
||||
'ovmf' => 2,
|
||||
'mem' => 4096 * 1024,
|
||||
'maxmem' => 4096 * 1024
|
||||
],
|
||||
'disk' => [
|
||||
[
|
||||
'size' => '64G'
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
|
||||
'Windows 10' => [
|
||||
'form' => 'Custom.form.php',
|
||||
'icon' => 'windows.png',
|
||||
@@ -1025,6 +1043,16 @@
|
||||
$strUSBMode = 'usb3-qemu';
|
||||
}
|
||||
|
||||
if (!empty($lv->domain_get_ovmf($res))) {
|
||||
if (is_file('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi.fd')) {
|
||||
$strOVMF = '1';
|
||||
} else if (is_file('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi-tpm.fd')) {
|
||||
$strOVMF = '2';
|
||||
} else {
|
||||
$strOVMF = '0';
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'template' => $arrTemplateValues,
|
||||
'domain' => [
|
||||
@@ -1044,7 +1072,7 @@
|
||||
'hyperv' => ($lv->domain_get_feature($res, 'hyperv') ? 1 : 0),
|
||||
'autostart' => ($lv->domain_get_autostart($res) ? 1 : 0),
|
||||
'state' => $lv->domain_state_translate($dom['state']),
|
||||
'ovmf' => ($lv->domain_get_ovmf($res) ? 1 : 0),
|
||||
'ovmf' => $strOVMF,
|
||||
'usbmode' => $strUSBMode
|
||||
],
|
||||
'media' => [
|
||||
|
||||
@@ -422,6 +422,11 @@
|
||||
} else {
|
||||
echo mk_option('', '0', _('OVMF').' ('._('Not Available').')', 'disabled');
|
||||
}
|
||||
if (file_exists('/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi-tpm.fd')) {
|
||||
echo mk_option($arrConfig['domain']['ovmf'], '2', _('OVMF TPM'));
|
||||
} else {
|
||||
echo mk_option('', '0', _('OVMF TPM').' ('._('Not Available').')', 'disabled');
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?if (!empty($arrConfig['domain']['state'])) {?>
|
||||
@@ -440,6 +445,11 @@
|
||||
<b>OVMF</b><br>
|
||||
(Open Virtual Machine Firmware) adds support for booting VMs using UEFI, but virtual machine guests must also support UEFI. Assigning graphics devices to a OVMF-based virtual machine requires that the graphics device also support UEFI.
|
||||
</p>
|
||||
<p>
|
||||
<b>OVMF TPM</b><br>
|
||||
(Open Virtual Machine Firmware) adds support for booting VMs using UEFI with TPM, but virtual machine guests must also support UEFI. Assigning graphics devices to a OVMF-based virtual machine requires that the graphics device also support UEFI.<br>
|
||||
<b>Only available if SWTPM plugin from the CA App is installed!</b>
|
||||
</p>
|
||||
<p>
|
||||
Once a VM is created this setting cannot be adjusted.
|
||||
</p>
|
||||
@@ -1254,7 +1264,8 @@ $(function() {
|
||||
}
|
||||
|
||||
$('.advancedview').change(function () {
|
||||
if ($(this).is(':checked')) {
|
||||
if
|
||||
($(this).is(':checked')) {
|
||||
setTimeout(function() {
|
||||
editor.refresh();
|
||||
}, 100);
|
||||
|
||||
BIN
plugins/dynamix.vm.manager/templates/images/windows11.png
Executable file
BIN
plugins/dynamix.vm.manager/templates/images/windows11.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 727 B |
Reference in New Issue
Block a user