fix(xo-web/host): host CPU hyperthreading detection (#4285)
Fixes #4262
This commit is contained in:
committed by
Pierre Donias
parent
8782151c5d
commit
ce338cb6ca
@@ -14,6 +14,7 @@
|
||||
### Bug fixes
|
||||
|
||||
- [Metadata backup] Missing XAPIs should trigger a failure job [#4281](https://github.com/vatesfr/xen-orchestra/issues/4281) (PR [#4283](https://github.com/vatesfr/xen-orchestra/pull/4283))
|
||||
- [Host/advanced] Fix host CPU hyperthreading detection [#4262](https://github.com/vatesfr/xen-orchestra/issues/4262) (PR [#4285](https://github.com/vatesfr/xen-orchestra/pull/4285))
|
||||
|
||||
### Released packages
|
||||
|
||||
|
||||
@@ -284,3 +284,19 @@ installSupplementalPack.params = {
|
||||
installSupplementalPack.resolve = {
|
||||
host: ['host', 'host', 'admin'],
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
export function isHyperThreadingEnabled({ host }) {
|
||||
return this.getXapi(host).isHyperThreadingEnabled(host._xapiId)
|
||||
}
|
||||
|
||||
isHyperThreadingEnabled.description = 'get hyper-threading information'
|
||||
|
||||
isHyperThreadingEnabled.params = {
|
||||
id: { type: 'string' },
|
||||
}
|
||||
|
||||
isHyperThreadingEnabled.resolve = {
|
||||
host: ['id', 'host', 'administrate'],
|
||||
}
|
||||
|
||||
@@ -2348,4 +2348,27 @@ export default class Xapi extends XapiBase {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
async isHyperThreadingEnabled(hostId) {
|
||||
try {
|
||||
return (
|
||||
(await this.call(
|
||||
'host.call_plugin',
|
||||
this.getObject(hostId).$ref,
|
||||
'hyperthreading.py',
|
||||
'get_hyperthreading',
|
||||
{}
|
||||
)) !== 'false'
|
||||
)
|
||||
} catch (error) {
|
||||
if (
|
||||
error.code === 'XENAPI_MISSING_PLUGIN' ||
|
||||
error.code === 'UNKNOWN_XENAPI_PLUGIN_FUNCTION'
|
||||
) {
|
||||
return null
|
||||
} else {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -797,6 +797,8 @@ const messages = {
|
||||
'RAM: {memoryUsed} used on {memoryTotal} ({memoryFree} free)',
|
||||
hardwareHostSettingsLabel: 'Hardware',
|
||||
hyperThreading: 'Hyper-threading (SMT)',
|
||||
hyperThreadingNotAvailable:
|
||||
'HT detection is only available on XCP-ng 7.6 and higher',
|
||||
hostAddress: 'Address',
|
||||
hostStatus: 'Status',
|
||||
hostBuildNumber: 'Build number',
|
||||
|
||||
@@ -780,6 +780,11 @@ export const emergencyShutdownHosts = hosts => {
|
||||
export const isHostTimeConsistentWithXoaTime = host =>
|
||||
_call('host.isHostServerTimeConsistent', { host: resolveId(host) })
|
||||
|
||||
export const isHyperThreadingEnabledHost = host =>
|
||||
_call('host.isHyperThreadingEnabled', {
|
||||
id: resolveId(host),
|
||||
})
|
||||
|
||||
// for XCP-ng now
|
||||
export const installAllPatchesOnHost = ({ host }) =>
|
||||
confirm({
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
disableHost,
|
||||
enableHost,
|
||||
forgetHost,
|
||||
isHyperThreadingEnabledHost,
|
||||
installSupplementalPack,
|
||||
restartHost,
|
||||
setHostsMultipathing,
|
||||
@@ -95,6 +96,12 @@ MultipathableSrs.propTypes = {
|
||||
}
|
||||
})
|
||||
export default class extends Component {
|
||||
async componentDidMount() {
|
||||
this.setState({
|
||||
isHtEnabled: await isHyperThreadingEnabledHost(this.props.host),
|
||||
})
|
||||
}
|
||||
|
||||
_getPacks = createSelector(
|
||||
() => this.props.host.supplementalPacks,
|
||||
packs => {
|
||||
@@ -112,14 +119,12 @@ export default class extends Component {
|
||||
return uniqPacks
|
||||
}
|
||||
)
|
||||
_isHtEnabled = createSelector(
|
||||
() => this.props.host.CPUs.flags,
|
||||
flags => /\bht\b/.test(flags)
|
||||
)
|
||||
|
||||
_setRemoteSyslogHost = value => setRemoteSyslogHost(this.props.host, value)
|
||||
|
||||
render() {
|
||||
const { host, pcis, pgpus } = this.props
|
||||
const { isHtEnabled } = this.state
|
||||
return (
|
||||
<Container>
|
||||
<Row>
|
||||
@@ -279,7 +284,9 @@ export default class extends Component {
|
||||
<tr>
|
||||
<th>{_('hyperThreading')}</th>
|
||||
<td>
|
||||
{this._isHtEnabled()
|
||||
{isHtEnabled === null
|
||||
? _('hyperThreadingNotAvailable')
|
||||
: isHtEnabled
|
||||
? _('stateEnabled')
|
||||
: _('stateDisabled')}
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user