feat(xo-server,xo-web/vm): expose VM UEFI secure boot option (#5527)

Fixes #5502
This commit is contained in:
Mathieu
2021-01-26 17:08:21 +01:00
committed by GitHub
parent a8359dcb75
commit db253875cc
7 changed files with 30 additions and 2 deletions

View File

@@ -16,6 +16,7 @@
- [Metadata backups] Ability to link a backup to a proxy (PR [#4206](https://github.com/vatesfr/xen-orchestra/pull/4206))
- [Proxy] Support metadata backups (PRs [#5499](https://github.com/vatesfr/xen-orchestra/pull/5499) [#5517](https://github.com/vatesfr/xen-orchestra/pull/5517))
- [VM/console] Add button to connect to the VM via the local RDP client [#5495](https://github.com/vatesfr/xen-orchestra/issues/5495) (PR [#5523](https://github.com/vatesfr/xen-orchestra/pull/5523))
- [VM] Ability to set guest secure boot (guest secure boot is available soon in XCP-ng) [#5502](https://github.com/vatesfr/xen-orchestra/issues/5502) (PR [#5527](https://github.com/vatesfr/xen-orchestra/pull/5527))
### Bug fixes

View File

@@ -626,6 +626,8 @@ set.params = {
startDelay: { type: 'integer', optional: true },
secureBoot: { type: 'boolean', optional: true },
// set the VM network interface controller
nicType: { type: ['string', 'null'], optional: true },

View File

@@ -409,6 +409,7 @@ const TRANSFORMS = {
snapshots: link(obj, 'snapshots'),
startDelay: +obj.start_delay,
startTime: metrics && toTimestamp(metrics.start_time),
secureBoot: obj.platform.secureboot === 'true',
tags: obj.tags,
VIFs: link(obj, 'VIFs'),
virtualizationMode: domainType,

View File

@@ -422,7 +422,9 @@ export default {
get: vm => +vm.start_delay,
set: (startDelay, vm) => vm.set_start_delay(startDelay),
},
secureBoot: {
set: (secureBoot, vm) => vm.update_platform('secureboot', secureBoot.toString()),
},
hvmBootFirmware: {
set: (firmware, vm) => vm.update_HVM_boot_params('firmware', firmware),
},

View File

@@ -1195,6 +1195,7 @@ const messages = {
deleteSnapshots: 'Remove selected snapshots',
copySnapshot: 'Create a VM from this snapshot',
exportSnapshot: 'Export this snapshot',
secureBoot: 'Secure boot',
snapshotDate: 'Creation date',
snapshotError: 'Snapshot error',
snapshotName: 'Name',

View File

@@ -316,6 +316,7 @@ export default class NewVm extends BaseComponent {
nbVms: NB_VMS_MIN,
VDIs: [],
VIFs: [],
secureBoot: false,
seqStart: 1,
share: false,
tags: [],
@@ -453,6 +454,7 @@ export default class NewVm extends BaseComponent {
bootAfterCreate: state.bootAfterCreate,
copyHostBiosStrings:
state.hvmBootFirmware !== 'uefi' && !this._templateHasBiosStrings() && state.copyHostBiosStrings,
secureBoot: state.secureBoot,
share: state.share,
cloudConfig,
networkConfig: this._isCoreOs() ? undefined : networkConfig,
@@ -551,6 +553,8 @@ export default class NewVm extends BaseComponent {
SR: this._getDefaultSr(template),
}
}),
// settings
secureBoot: template.secureBoot,
})
if (this._isCoreOs()) {
@@ -829,7 +833,7 @@ export default class NewVm extends BaseComponent {
_getRedirectionUrl = id => (this.state.state.multipleVms ? '/home' : `/vms/${id}`)
_handleBootFirmware = value => this._setState({ hvmBootFirmware: value })
_handleBootFirmware = value => this._setState({ hvmBootFirmware: value, secureBoot: false })
// MAIN ------------------------------------------------------------------------
@@ -1481,6 +1485,7 @@ export default class NewVm extends BaseComponent {
nameLabels,
namePattern,
nbVms,
secureBoot,
seqStart,
share,
showAdvanced,
@@ -1688,6 +1693,13 @@ export default class NewVm extends BaseComponent {
</Item>
</SectionContent>
),
hvmBootFirmware === 'uefi' && (
<SectionContent>
<Item label={_('secureBoot')}>
<Toggle onChange={this._toggleState('secureBoot')} value={secureBoot} />
</Item>
</SectionContent>
),
isAdmin && isHvm && (
<SectionContent>
<Item>

View File

@@ -429,6 +429,7 @@ export default class TabAdvanced extends Component {
_handleBootFirmware = value =>
editVm(this.props.vm, {
secureBoot: false,
hvmBootFirmware: value !== '' ? value : null,
})
@@ -772,6 +773,14 @@ export default class TabAdvanced extends Component {
</td>
</tr>
)}
{vm.boot.firmware === 'uefi' && (
<tr>
<th>{_('secureBoot')}</th>
<td>
<Toggle value={vm.secureBoot} onChange={value => editVm(vm, { secureBoot: value })} />
</td>
</tr>
)}
<tr>
<th>{_('customFields')}</th>
<td>