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')"
|
:label="t('harvester.virtualMachine.secureBoot')"
|
||||||
:mode="mode"
|
:mode="mode"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Checkbox
|
||||||
|
v-if="tpmEnabled || efiEnabled"
|
||||||
|
class="check"
|
||||||
|
type="checkbox"
|
||||||
|
:label="t('harvester.virtualMachine.advancedOptions.persistentState')"
|
||||||
|
:mode="mode"
|
||||||
|
:value="true"
|
||||||
|
:disabled="true"
|
||||||
|
/>
|
||||||
|
|
||||||
<Banner
|
<Banner
|
||||||
v-if="showCpuPinningBanner"
|
v-if="showCpuPinningBanner"
|
||||||
color="warning"
|
color="warning"
|
||||||
|
|||||||
@ -594,6 +594,7 @@ harvester:
|
|||||||
enableUsb: Enable USB Tablet
|
enableUsb: Enable USB Tablet
|
||||||
advancedOptions:
|
advancedOptions:
|
||||||
tpm: Enable TPM
|
tpm: Enable TPM
|
||||||
|
persistentState: Persistent State
|
||||||
cpuManager:
|
cpuManager:
|
||||||
prefix: You must enable CPU Manager for at least one node in
|
prefix: You must enable CPU Manager for at least one node in
|
||||||
middle: 'host page'
|
middle: 'host page'
|
||||||
|
|||||||
@ -1384,25 +1384,30 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
setBootMethod(boot = { efi: false, secureBoot: false }) {
|
setBootMethod(boot = { efi: false, secureBoot: false }) {
|
||||||
if (boot.efi && boot.secureBoot) {
|
if (!boot.efi) {
|
||||||
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);
|
|
||||||
|
|
||||||
try {
|
|
||||||
delete this.spec.template.spec.domain.features.smm['enabled'];
|
|
||||||
const noKeys = Object.keys(this.spec.template.spec.domain.features.smm).length === 0;
|
|
||||||
|
|
||||||
if (noKeys) {
|
|
||||||
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['firmware'];
|
||||||
delete this.spec.template.spec.domain.features['smm'];
|
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);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const smm = this.spec.template.spec.domain.features.smm;
|
||||||
|
|
||||||
|
delete smm['enabled'];
|
||||||
|
if (Object.keys(smm).length === 0) {
|
||||||
|
delete this.spec.template.spec.domain.features['smm'];
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
},
|
},
|
||||||
|
|
||||||
setCpuPinning(value) {
|
setCpuPinning(value) {
|
||||||
@ -1415,7 +1420,7 @@ export default {
|
|||||||
|
|
||||||
setTPM(tpmEnabled) {
|
setTPM(tpmEnabled) {
|
||||||
if (tpmEnabled) {
|
if (tpmEnabled) {
|
||||||
set(this.spec.template.spec.domain.devices, 'tpm', {});
|
set(this.spec.template.spec.domain.devices, 'tpm.persistent', true);
|
||||||
} else {
|
} else {
|
||||||
delete this.spec.template.spec.domain.devices['tpm'];
|
delete this.spec.template.spec.domain.devices['tpm'];
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user