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): display bond mode of a network #8010

Merged
merged 8 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- `rest post` and `rest put` now accept `--input $file` to upload a file and display progress information
- [Backup] Detect invalid VDI exports that are incorrectly reported as successful by XAPI
- [Backup/HealthCheck] Improve error messages on health check timeout (PR [#8016](https://github.com/vatesfr/xen-orchestra/pull/8016))
MathieuRA marked this conversation as resolved.
Show resolved Hide resolved
- [Pool/Network] Display the bond mode of a network [#7802](https://github.com/vatesfr/xen-orchestra/issues/7802) (PR [#8010](https://github.com/vatesfr/xen-orchestra/pull/8010))

### Bug fixes

Expand Down Expand Up @@ -48,6 +49,6 @@
- xen-api minor
- xo-cli minor
- xo-server minor
- xo-web patch
- xo-web minor

<!--packages-end-->
10 changes: 10 additions & 0 deletions packages/xo-server/src/xapi-object-to-xo.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,16 @@ const TRANSFORMS = {
VUSBs: link(obj, 'VUSBs'),
}
},

// -----------------------------------------------------------------

bond(obj) {
return {
type: 'bond',
master: link(obj, 'master'),
mode: obj.mode,
}
},
}

// ===================================================================
Expand Down
1 change: 1 addition & 0 deletions packages/xo-web/src/common/intl/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,7 @@ const messages = {
noHost: 'No hosts',
memoryLeftTooltip: '{used}% used ({free} free)',
// ----- Pool network tab -----
bondMode: 'Bond Mode',
pif: 'PIF',
poolNetworkAutomatic: 'Automatic',
poolNetworkNameLabel: 'Name',
Expand Down
11 changes: 8 additions & 3 deletions packages/xo-web/src/common/sorted-table/pifs-column.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import map from 'lodash/map'
import React, { Component } from 'react'
import Tooltip from 'tooltip'
import { connectStore } from 'utils'
import { createGetObject, createSelector } from 'selectors'
import { createGetObject, createGetObjectsOfType, createSelector } from 'selectors'
import { connectPif, disconnectPif } from 'xo'

@connectStore(() => {
Expand All @@ -19,18 +19,22 @@ import { connectPif, disconnectPif } from 'xo'
pif => pif?.attached && !pif?.isBondMaster && (pif?.management || pif?.disallowUnplug)
)

return { host, pif, disableUnplug }
const bonds = createGetObjectsOfType('bond')
const bond = createSelector(pif, bonds, (pif, bonds) => Object.values(bonds).find(bond => bond.master === pif.id))

return { host, pif, disableUnplug, bond }
})
class PifItem extends Component {
render() {
const { pif, host, disableUnplug } = this.props
const { pif, host, disableUnplug, bond } = this.props

return (
<tr>
<td>{pif?.device ?? _('unknown')}</td>
<td>{host?.name_label ?? _('unknown')}</td>
<td>{pif?.ip ?? _('unknown')}</td>
<td>{pif?.mac ?? _('unknown')}</td>
<td>{bond?.mode ?? '-'}</td>
<td>
{pif?.carrier === undefined ? (
<span className='tag tag-warning'>{_('unknown')}</span>
Expand Down Expand Up @@ -78,6 +82,7 @@ export default class PifsColumn extends BaseComponent {
<th>{_('homeTypeHost')}</th>
<th>{_('pifAddressLabel')}</th>
<th>{_('pifMacLabel')}</th>
<th>{_('bondMode')}</th>
<th>{_('pifStatusLabel')}</th>
<th />
</tr>
Expand Down
Loading