mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 13:11:43 +00:00
feat: add efi persistent state
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
This commit is contained in:
parent
f9a277d893
commit
b92f22fa75
@ -49,6 +49,7 @@ const featuresV142 = [
|
|||||||
const featuresV150 = [
|
const featuresV150 = [
|
||||||
...featuresV142,
|
...featuresV142,
|
||||||
'tpmPersistentState',
|
'tpmPersistentState',
|
||||||
|
'efiPersistentState',
|
||||||
'untaggedNetworkSetting',
|
'untaggedNetworkSetting',
|
||||||
'skipSingleReplicaDetachedVol'
|
'skipSingleReplicaDetachedVol'
|
||||||
];
|
];
|
||||||
|
|||||||
@ -478,7 +478,16 @@ export default {
|
|||||||
v-model:value="efiEnabled"
|
v-model:value="efiEnabled"
|
||||||
class="check"
|
class="check"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
:label="t('harvester.virtualMachine.efiEnabled')"
|
:label="t('harvester.virtualMachine.advancedOptions.efiEnabled')"
|
||||||
|
:mode="mode"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Checkbox
|
||||||
|
v-if="value.efiPersistentStateFeatureEnabled && efiEnabled"
|
||||||
|
v-model:value="efiPersistentStateEnabled"
|
||||||
|
class="check"
|
||||||
|
type="checkbox"
|
||||||
|
:label="t('harvester.virtualMachine.advancedOptions.efiPersistentState')"
|
||||||
:mode="mode"
|
:mode="mode"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@ -487,7 +496,7 @@ export default {
|
|||||||
v-model:value="secureBoot"
|
v-model:value="secureBoot"
|
||||||
class="check"
|
class="check"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
:label="t('harvester.virtualMachine.secureBoot')"
|
:label="t('harvester.virtualMachine.advancedOptions.secureBoot')"
|
||||||
:mode="mode"
|
:mode="mode"
|
||||||
/>
|
/>
|
||||||
</Tab>
|
</Tab>
|
||||||
|
|||||||
@ -886,7 +886,16 @@ export default {
|
|||||||
v-model:value="efiEnabled"
|
v-model:value="efiEnabled"
|
||||||
class="check"
|
class="check"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
:label="t('harvester.virtualMachine.efiEnabled')"
|
:label="t('harvester.virtualMachine.advancedOptions.efiEnabled')"
|
||||||
|
:mode="mode"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Checkbox
|
||||||
|
v-if="value.efiPersistentStateFeatureEnabled && efiEnabled"
|
||||||
|
v-model:value="efiPersistentStateEnabled"
|
||||||
|
class="check"
|
||||||
|
type="checkbox"
|
||||||
|
:label="t('harvester.virtualMachine.advancedOptions.efiPersistentState')"
|
||||||
:mode="mode"
|
:mode="mode"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@ -895,7 +904,7 @@ export default {
|
|||||||
v-model:value="secureBoot"
|
v-model:value="secureBoot"
|
||||||
class="check"
|
class="check"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
:label="t('harvester.virtualMachine.secureBoot')"
|
:label="t('harvester.virtualMachine.advancedOptions.secureBoot')"
|
||||||
:mode="mode"
|
:mode="mode"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@ -604,11 +604,12 @@ harvester:
|
|||||||
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'
|
||||||
suffix: to enable CPU Pinning for VM
|
suffix: to enable CPU Pinning for VM
|
||||||
|
efiEnabled: Booting in EFI mode
|
||||||
|
efiPersistentState: EFI Persistent State
|
||||||
|
secureBoot: Secure Boot
|
||||||
usbTip: Provides an absolute pointer device which often helps with getting a consistent mouse cursor position in VNC.
|
usbTip: Provides an absolute pointer device which often helps with getting a consistent mouse cursor position in VNC.
|
||||||
sshTitle: Add Public SSH Key
|
sshTitle: Add Public SSH Key
|
||||||
imageTip: An external URL to the .iso, .img, .qcow2 or .raw that the virtual machine should be created from.
|
imageTip: An external URL to the .iso, .img, .qcow2 or .raw that the virtual machine should be created from.
|
||||||
efiEnabled: Booting in EFI mode
|
|
||||||
secureBoot: Secure Boot
|
|
||||||
volume:
|
volume:
|
||||||
dragTip: Drag and drop volumes, or use the volume's arrows, to change the boot order.
|
dragTip: Drag and drop volumes, or use the volume's arrows, to change the boot order.
|
||||||
volumeTip: The virtual machine only contains a CD-ROM volume. You may want to add additional disk volumes.
|
volumeTip: The virtual machine only contains a CD-ROM volume. You may want to add additional disk volumes.
|
||||||
|
|||||||
@ -144,6 +144,10 @@ export default {
|
|||||||
return !!spec?.template?.spec?.domain?.devices?.tpm?.persistent;
|
return !!spec?.template?.spec?.domain?.devices?.tpm?.persistent;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isEFIPersistentStateEnabled(spec) {
|
||||||
|
return !!spec?.template?.spec?.domain?.firmware?.bootloader?.efi?.persistent;
|
||||||
|
},
|
||||||
|
|
||||||
isSecureBoot(spec) {
|
isSecureBoot(spec) {
|
||||||
return !!spec?.template?.spec?.domain?.firmware?.bootloader?.efi?.secureBoot;
|
return !!spec?.template?.spec?.domain?.firmware?.bootloader?.efi?.secureBoot;
|
||||||
},
|
},
|
||||||
|
|||||||
@ -165,6 +165,7 @@ export default {
|
|||||||
efiEnabled: false,
|
efiEnabled: false,
|
||||||
tpmEnabled: false,
|
tpmEnabled: false,
|
||||||
tpmPersistentStateEnabled: false,
|
tpmPersistentStateEnabled: false,
|
||||||
|
efiPersistentStateEnabled: false,
|
||||||
secureBoot: false,
|
secureBoot: false,
|
||||||
userDataTemplateId: '',
|
userDataTemplateId: '',
|
||||||
saveUserDataAsClearText: false,
|
saveUserDataAsClearText: false,
|
||||||
@ -369,6 +370,7 @@ export default {
|
|||||||
const efiEnabled = this.isEfiEnabled(spec);
|
const efiEnabled = this.isEfiEnabled(spec);
|
||||||
const tpmEnabled = this.isTpmEnabled(spec);
|
const tpmEnabled = this.isTpmEnabled(spec);
|
||||||
const tpmPersistentStateEnabled = this.isTPMPersistentStateEnabled(spec);
|
const tpmPersistentStateEnabled = this.isTPMPersistentStateEnabled(spec);
|
||||||
|
const efiPersistentStateEnabled = this.isEFIPersistentStateEnabled(spec);
|
||||||
const secureBoot = this.isSecureBoot(spec);
|
const secureBoot = this.isSecureBoot(spec);
|
||||||
const cpuPinning = this.isCpuPinning(spec);
|
const cpuPinning = this.isCpuPinning(spec);
|
||||||
|
|
||||||
@ -400,6 +402,7 @@ export default {
|
|||||||
|
|
||||||
this['installUSBTablet'] = installUSBTablet;
|
this['installUSBTablet'] = installUSBTablet;
|
||||||
this['efiEnabled'] = efiEnabled;
|
this['efiEnabled'] = efiEnabled;
|
||||||
|
this['efiPersistentStateEnabled'] = efiPersistentStateEnabled;
|
||||||
this['tpmEnabled'] = tpmEnabled;
|
this['tpmEnabled'] = tpmEnabled;
|
||||||
this['tpmPersistentStateEnabled'] = tpmPersistentStateEnabled;
|
this['tpmPersistentStateEnabled'] = tpmPersistentStateEnabled;
|
||||||
this['secureBoot'] = secureBoot;
|
this['secureBoot'] = secureBoot;
|
||||||
@ -1386,13 +1389,20 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setBootMethod(boot = { efi: false, secureBoot: false }) {
|
setBootMethod(boot = { efi: false, secureBoot: false, efiPersistentStateEnabled: 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', boot.secureBoot);
|
||||||
set(this.spec.template.spec.domain, 'firmware.bootloader.efi.secureBoot', true);
|
set(this.spec.template.spec.domain, 'firmware.bootloader.efi.persistent', boot.efiPersistentStateEnabled);
|
||||||
} else if (boot.efi && !boot.secureBoot) {
|
} else {
|
||||||
// set(this.spec.template.spec.domain, 'features.smm.enabled', false);
|
delete this.spec.template.spec.domain['firmware'];
|
||||||
|
delete this.spec.template.spec.domain.features['smm'];
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (boot.secureBoot) {
|
||||||
|
set(this.spec.template.spec.domain, 'features.smm.enabled', true);
|
||||||
|
} else {
|
||||||
try {
|
try {
|
||||||
delete this.spec.template.spec.domain.features.smm['enabled'];
|
delete this.spec.template.spec.domain.features.smm['enabled'];
|
||||||
const noKeys = Object.keys(this.spec.template.spec.domain.features.smm).length === 0;
|
const noKeys = Object.keys(this.spec.template.spec.domain.features.smm).length === 0;
|
||||||
@ -1401,10 +1411,6 @@ export default {
|
|||||||
delete this.spec.template.spec.domain.features['smm'];
|
delete this.spec.template.spec.domain.features['smm'];
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} 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'];
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1540,11 +1546,21 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
efiEnabled(val) {
|
efiEnabled(val) {
|
||||||
this.setBootMethod({ efi: val, secureBoot: this.secureBoot });
|
this.setBootMethod({
|
||||||
|
efi: val, secureBoot: this.secureBoot, efiPersistentStateEnabled: this.efiPersistentStateEnabled
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
secureBoot(val) {
|
secureBoot(val) {
|
||||||
this.setBootMethod({ efi: this.efiEnabled, secureBoot: val });
|
this.setBootMethod({
|
||||||
|
efi: this.efiEnabled, secureBoot: val, efiPersistentStateEnabled: this.efiPersistentStateEnabled
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
efiPersistentStateEnabled(val) {
|
||||||
|
this.setBootMethod({
|
||||||
|
efi: this.efiEnabled, secureBoot: this.secureBoot, efiPersistentStateEnabled: val
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
cpuPinning(value) {
|
cpuPinning(value) {
|
||||||
|
|||||||
@ -280,4 +280,8 @@ export default class HciVmTemplateVersion extends HarvesterResource {
|
|||||||
get tpmPersistentStateFeatureEnabled() {
|
get tpmPersistentStateFeatureEnabled() {
|
||||||
return this.$rootGetters['harvester-common/getFeatureEnabled']('tpmPersistentState');
|
return this.$rootGetters['harvester-common/getFeatureEnabled']('tpmPersistentState');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get efiPersistentStateFeatureEnabled() {
|
||||||
|
return this.$rootGetters['harvester-common/getFeatureEnabled']('efiPersistentState');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1179,6 +1179,10 @@ export default class VirtVm extends HarvesterResource {
|
|||||||
return this.$rootGetters['harvester-common/getFeatureEnabled']('tpmPersistentState');
|
return this.$rootGetters['harvester-common/getFeatureEnabled']('tpmPersistentState');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get efiPersistentStateFeatureEnabled() {
|
||||||
|
return this.$rootGetters['harvester-common/getFeatureEnabled']('efiPersistentState');
|
||||||
|
}
|
||||||
|
|
||||||
setInstanceLabels(val) {
|
setInstanceLabels(val) {
|
||||||
if ( !this.spec?.template?.metadata?.labels ) {
|
if ( !this.spec?.template?.metadata?.labels ) {
|
||||||
set(this, 'spec.template.metadata.labels', {});
|
set(this, 'spec.template.metadata.labels', {});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user