mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 21:21:44 +00:00
Merge pull request #132 from houhoucoop/feat/issue-7557
feat: add EFI persistent state checkbox in VM advanced tab
This commit is contained in:
commit
a55353fd1b
@ -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,21 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setBootMethod(boot = { efi: false, secureBoot: false }) {
|
setBootMethod(boot = {
|
||||||
if (boot.efi && boot.secureBoot) {
|
efi: false, secureBoot: false, efiPersistentStateEnabled: false
|
||||||
set(this.spec.template.spec.domain, 'features.smm.enabled', true);
|
}) {
|
||||||
set(this.spec.template.spec.domain, 'firmware.bootloader.efi.secureBoot', true);
|
if (boot.efi) {
|
||||||
} else if (boot.efi && !boot.secureBoot) {
|
set(this.spec.template.spec.domain, 'firmware.bootloader.efi.secureBoot', boot.secureBoot);
|
||||||
// set(this.spec.template.spec.domain, 'features.smm.enabled', false);
|
} else {
|
||||||
|
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 +1412,12 @@ 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);
|
}
|
||||||
|
|
||||||
|
if (boot.efiPersistentStateEnabled) {
|
||||||
|
set(this.spec.template.spec.domain, 'firmware.bootloader.efi.persistent', true);
|
||||||
} else {
|
} else {
|
||||||
delete this.spec.template.spec.domain['firmware'];
|
delete this.spec.template.spec.domain.firmware.bootloader.efi['persistent'];
|
||||||
delete this.spec.template.spec.domain.features['smm'];
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1416,22 +1429,14 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setTPM(tpmEnabled) {
|
setTPM({ tpmEnabled = false, tpmPersistentStateEnabled = false } = {}) {
|
||||||
if (tpmEnabled) {
|
if (tpmEnabled) {
|
||||||
set(this.spec.template.spec.domain.devices, 'tpm', {});
|
set(this.spec.template.spec.domain.devices, 'tpm', tpmPersistentStateEnabled ? { persistent: true } : {});
|
||||||
} else {
|
} else {
|
||||||
delete this.spec.template.spec.domain.devices['tpm'];
|
delete this.spec.template.spec.domain.devices['tpm'];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setTPMPersistentStateEnabled(tpmPersistentStateEnabled) {
|
|
||||||
if (tpmPersistentStateEnabled) {
|
|
||||||
set(this.spec.template.spec.domain.devices, 'tpm', { persistent: true });
|
|
||||||
} else {
|
|
||||||
set(this.spec.template.spec.domain.devices, 'tpm', {});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
deleteSSHFromUserData(ssh = []) {
|
deleteSSHFromUserData(ssh = []) {
|
||||||
const sshAuthorizedKeys = this.getSSHFromUserData(this.userScript);
|
const sshAuthorizedKeys = this.getSSHFromUserData(this.userScript);
|
||||||
|
|
||||||
@ -1540,11 +1545,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) {
|
||||||
@ -1552,11 +1567,11 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
tpmEnabled(val) {
|
tpmEnabled(val) {
|
||||||
this.setTPM(val);
|
this.setTPM({ tpmEnabled: val, tpmPersistentStateEnabled: this.tpmPersistentStateEnabled });
|
||||||
},
|
},
|
||||||
|
|
||||||
tpmPersistentStateEnabled(val) {
|
tpmPersistentStateEnabled(val) {
|
||||||
this.setTPMPersistentStateEnabled(val);
|
this.setTPM({ tpmEnabled: this.tpmEnabled, tpmPersistentStateEnabled: val });
|
||||||
},
|
},
|
||||||
|
|
||||||
installAgent: {
|
installAgent: {
|
||||||
|
|||||||
@ -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