-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(xo-server/xo-web): in host advanced tab, display mdadm status #8190
base: master
Are you sure you want to change the base?
Conversation
@@ -1569,4 +1569,24 @@ export default class Xapi extends XapiBase { | |||
|
|||
return { currentBiosVersion, latestBiosVersion, biosLink, isUpToDate } | |||
} | |||
|
|||
async getHostMdadmHealth(hostId, { cache } = {}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why put a cache in this method?
check_raid_pool
takes a long time to respond?
return cache.get(hostId) | ||
} | ||
try { | ||
const result = await this.call('host.call_plugin', this.getObject(hostId).$ref, 'raid.py', 'check_raid_pool', {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the call take more than a second, use this.callAsync
async getHostMdadmHealth(hostId, { cache } = {}) { | ||
if (cache?.has(hostId)) { | ||
return cache.get(hostId) | ||
} | ||
try { | ||
const result = await this.call('host.call_plugin', this.getObject(hostId).$ref, 'raid.py', 'check_raid_pool', {}) | ||
const parsedResult = JSON.parse(result) | ||
|
||
cache?.set(hostId, parsedResult) | ||
|
||
return parsedResult | ||
} catch (error) { | ||
if (error.code === 'XENAPI_MISSING_PLUGIN' || error.code === 'UNKNOWN_XENAPI_PLUGIN_FUNCTION') { | ||
return null | ||
} else { | ||
throw error | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, this method can be moved into @xen-orchestra/xapi/host.mjs
@@ -63,6 +64,7 @@ export default class HostItem extends Component { | |||
state = { | |||
isHostTimeConsistentWithXoaTime: true, | |||
isPubKeyTooShort: false, | |||
mdadmHealth: null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why initialize as null
instead of undefined
?
@@ -262,6 +273,17 @@ export default class HostItem extends Component { | |||
}) | |||
} | |||
|
|||
if (mdadmHealth?.raid?.State && !['clean', 'active'].includes(mdadmHealth.raid.State)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always explicit condition. Exepct for boolean
if (mdadmHealth?.raid?.State && !['clean', 'active'].includes(mdadmHealth.raid.State)) { | |
if (mdadmHealth?.raid?.State !== undefined && !['clean', 'active'].includes(mdadmHealth.raid.State)) { |
this.setState({ | ||
isHtEnabled: await isHyperThreadingEnabledHost(host).catch(() => null), | ||
isSmartctlHealthEnabled, | ||
pciStateById, | ||
smartctlUnhealthyDevices, | ||
unhealthyDevicesAlerts, | ||
isPciPassthroughAvailable: _isPciPassthroughAvailable, | ||
mdadmHealthAvailable: mdadmHealth?.raid ? mdadmHealth : null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mdadmHealthAvailable
seems to indicate that we are expecting a boolean.
mdadmHealthAvailable: mdadmHealth?.raid ? mdadmHealth : null, | |
mdadmHealthAvailable: mdadmHealth != null ? true : false, |
this.setState({ | ||
isHtEnabled: await isHyperThreadingEnabledHost(host).catch(() => null), | ||
isSmartctlHealthEnabled, | ||
pciStateById, | ||
smartctlUnhealthyDevices, | ||
unhealthyDevicesAlerts, | ||
isPciPassthroughAvailable: _isPciPassthroughAvailable, | ||
mdadmHealthAvailable: mdadmHealth?.raid ? mdadmHealth : null, | ||
mdadmState: mdadmHealth.raid?.State, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mdadmState: mdadmHealthAvailable ? mdadmHealth.raid?.State : undefined,
{mdadmHealthAvailable && ( | ||
<tr> | ||
<th>{_('raidStatus')}</th> | ||
<td>{mdadmState === 'clean' || mdadmState === 'active' ? _('raidHealthy') : mdadmState}</td> | ||
</tr> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid to hide information, add a message that explain "Why mdadmHealthAvailable is false".
It will probably depend of the mdadmHealth
, but it can be plugin not installed
, or no raid on the host
- [Host] In host and advanced view, display MDADM health information (PR [#8190](https://github.com/vatesfr/xen-orchestra/pull/8190)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- [Host] In host and advanced view, display MDADM health information (PR [#8190](https://github.com/vatesfr/xen-orchestra/pull/8190)) | |
- [Host/Advanced] In host's advanced tab, display MDADM health information (PR [#8190](https://github.com/vatesfr/xen-orchestra/pull/8190)) | |
return this.getXapi(host).getHostMdadmHealth(host._xapiId, { cache: CACHE_MDADM }) | ||
} | ||
|
||
getMdadmHealth.description = 'get mdadm health status' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get mdadm health status
sound like it returns a simple string..
Additionally, the GH issue in the PR description does not seem relevant |
Description
Fixes #763
Checklist
Fixes #007
,See xoa-support#42
,See https://...
)Introduced by
CHANGELOG.unreleased.md
Review process
Notes: