mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 21:21:44 +00:00
feat: add persistent state checkbox
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
This commit is contained in:
parent
5c96e90d58
commit
e8017e14c8
@ -889,6 +889,17 @@ export default {
|
||||
:label="t('harvester.virtualMachine.secureBoot')"
|
||||
:mode="mode"
|
||||
/>
|
||||
|
||||
<Checkbox
|
||||
v-if="tpmEnabled || efiEnabled"
|
||||
class="check"
|
||||
type="checkbox"
|
||||
:label="t('harvester.virtualMachine.advancedOptions.persistentState')"
|
||||
:mode="mode"
|
||||
:value="true"
|
||||
:disabled="true"
|
||||
/>
|
||||
|
||||
<Banner
|
||||
v-if="showCpuPinningBanner"
|
||||
color="warning"
|
||||
|
||||
@ -594,6 +594,7 @@ harvester:
|
||||
enableUsb: Enable USB Tablet
|
||||
advancedOptions:
|
||||
tpm: Enable TPM
|
||||
persistentState: Persistent State
|
||||
cpuManager:
|
||||
prefix: You must enable CPU Manager for at least one node in
|
||||
middle: 'host page'
|
||||
|
||||
@ -1384,25 +1384,30 @@ export default {
|
||||
},
|
||||
|
||||
setBootMethod(boot = { efi: false, secureBoot: false }) {
|
||||
if (boot.efi && boot.secureBoot) {
|
||||
if (!boot.efi) {
|
||||
delete this.spec.template.spec.domain['firmware'];
|
||||
delete this.spec.template.spec.domain.features['smm'];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
set(this.spec.template.spec.domain, 'firmware.bootloader.efi.persistent', true);
|
||||
set(this.spec.template.spec.domain, 'firmware.bootloader.efi.secureBoot', !!boot.secureBoot);
|
||||
|
||||
if (boot.secureBoot) {
|
||||
set(this.spec.template.spec.domain, 'features.smm.enabled', true);
|
||||
set(this.spec.template.spec.domain, 'firmware.bootloader.efi.secureBoot', true);
|
||||
} else if (boot.efi && !boot.secureBoot) {
|
||||
// set(this.spec.template.spec.domain, 'features.smm.enabled', false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
delete this.spec.template.spec.domain.features.smm['enabled'];
|
||||
const noKeys = Object.keys(this.spec.template.spec.domain.features.smm).length === 0;
|
||||
const smm = this.spec.template.spec.domain.features.smm;
|
||||
|
||||
if (noKeys) {
|
||||
delete smm['enabled'];
|
||||
if (Object.keys(smm).length === 0) {
|
||||
delete this.spec.template.spec.domain.features['smm'];
|
||||
}
|
||||
} catch (e) {}
|
||||
set(this.spec.template.spec.domain, 'firmware.bootloader.efi.secureBoot', false);
|
||||
} else {
|
||||
delete this.spec.template.spec.domain['firmware'];
|
||||
delete this.spec.template.spec.domain.features['smm'];
|
||||
}
|
||||
},
|
||||
|
||||
setCpuPinning(value) {
|
||||
@ -1415,7 +1420,7 @@ export default {
|
||||
|
||||
setTPM(tpmEnabled) {
|
||||
if (tpmEnabled) {
|
||||
set(this.spec.template.spec.domain.devices, 'tpm', {});
|
||||
set(this.spec.template.spec.domain.devices, 'tpm.persistent', true);
|
||||
} else {
|
||||
delete this.spec.template.spec.domain.devices['tpm'];
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user