Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MelissaFrncJrg
Copy link
Contributor

Description

Fixes #763
mdadm-status-advanced-view
mdadm-status-host-view

Checklist

  • Commit
    • Title follows commit conventions
    • Reference the relevant issue (Fixes #007, See xoa-support#42, See https://...)
    • If bug fix, add Introduced by
  • Changelog
    • If visible by XOA users, add changelog entry
    • Update "Packages to release" in CHANGELOG.unreleased.md
  • PR
    • If UI changes, add screenshots
    • If not finished or not tested, open as Draft

Review process

This 2-passes review process aims to:

  • develop skills of junior reviewers
  • limit the workload for senior reviewers
  • limit the number of unnecessary changes by the author
  1. The author creates a PR.
  2. Review process:
    1. The author assigns the junior reviewer.
    2. The junior reviewer conducts their review:
      • Resolves their comments if they are addressed.
      • Adds comments if necessary or approves the PR.
    3. The junior reviewer assigns the senior reviewer.
    4. The senior reviewer conducts their review:
      • If there are no unresolved comments on the PR → merge.
      • Otherwise, we continue with 3.
  3. The author responds to comments and/or makes corrections, and we go back to 2.

Notes:

  1. The author can request a review at any time, even if the PR is still a Draft.
  2. In theory, there should not be more than one reviewer at a time.
  3. The author should not make any changes:
    • When a reviewer is assigned.
    • Between the junior and senior reviews.

@MelissaFrncJrg MelissaFrncJrg marked this pull request as ready for review December 12, 2024 16:59
@@ -1569,4 +1569,24 @@ export default class Xapi extends XapiBase {

return { currentBiosVersion, latestBiosVersion, biosLink, isUpToDate }
}

async getHostMdadmHealth(hostId, { cache } = {}) {
Copy link
Member

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', {})
Copy link
Member

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

Comment on lines +1573 to +1591
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
}
}
}
Copy link
Member

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,
Copy link
Member

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)) {
Copy link
Member

@MathieuRA MathieuRA Dec 16, 2024

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

Suggested change
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,
Copy link
Member

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.

Suggested change
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,
Copy link
Member

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,

Comment on lines +698 to +703
{mdadmHealthAvailable && (
<tr>
<th>{_('raidStatus')}</th>
<td>{mdadmState === 'clean' || mdadmState === 'active' ? _('raidHealthy') : mdadmState}</td>
</tr>
)}
Copy link
Member

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

Comment on lines +16 to +17
- [Host] In host and advanced view, display MDADM health information (PR [#8190](https://github.com/vatesfr/xen-orchestra/pull/8190))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [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'
Copy link
Member

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..

@MathieuRA MathieuRA requested a review from pdonias December 16, 2024 15:16
@MathieuRA
Copy link
Member

Additionally, the GH issue in the PR description does not seem relevant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

host & pool Citrix license status
2 participants