Compare commits

..

4 Commits

Author SHA1 Message Date
b-Nollet
f9e894ea73 minimum MTU value for network creation 2024-02-21 12:28:02 +01:00
Pizzosaure
608bee442f Changelog entry added 2024-02-21 11:20:32 +01:00
Pizzosaure
d9011bd467 front modifications 2024-02-21 11:20:32 +01:00
b-Nollet
398f3da58a feat(xo-server): change MTU 2024-02-21 11:20:21 +01:00
4 changed files with 27 additions and 39 deletions

View File

@@ -9,6 +9,7 @@
- Disable search engine indexing via a `robots.txt`
- [Stats] Support format used by XAPI 23.31
- [Pool/Network] Ability to edit MTU [#7039](https://github.com/vatesfr/xen-orchestra/issues/7039) (PR [#7393](https://github.com/vatesfr/xen-orchestra/pull/7393))
### Bug fixes
@@ -17,6 +18,7 @@
- [Settings/XO Config] Sort backups from newest to oldest
- [Plugins/audit] Don't log `tag.getAllConfigured` calls
- [Remotes] Correctly clear error when the remote is tested with success
- [Pool/Network] Don't allow MTU values that are too small to work (<68)
### Packages to release
@@ -40,6 +42,6 @@
- vhd-lib patch
- xo-server minor
- xo-server-audit patch
- xo-web patch
- xo-web minor
<!--packages-end-->

View File

@@ -1,5 +1,7 @@
import xapiObjectToXo from '../xapi-object-to-xo.mjs'
const RFC_MINIMUM_MTU = 68 // see RFC 791
export function getBondModes() {
return ['balance-slb', 'active-backup', 'lacp']
}
@@ -26,7 +28,7 @@ create.params = {
nbd: { type: 'boolean', optional: true },
description: { type: 'string', minLength: 0, optional: true },
pif: { type: 'string', optional: true },
mtu: { type: 'integer', optional: true },
mtu: { type: 'integer', optional: true, minimum: RFC_MINIMUM_MTU },
vlan: { type: 'integer', optional: true },
}
@@ -56,7 +58,7 @@ createBonded.params = {
type: 'string',
},
},
mtu: { type: 'integer', optional: true },
mtu: { type: 'integer', optional: true, minimum: RFC_MINIMUM_MTU },
bondMode: { enum: getBondModes() },
}
@@ -72,6 +74,7 @@ export async function set({
automatic,
defaultIsLocked,
mtu,
name_description: nameDescription,
name_label: nameLabel,
nbd,
@@ -81,6 +84,7 @@ export async function set({
await Promise.all([
automatic !== undefined && network.update_other_config('automatic', automatic ? 'true' : null),
defaultIsLocked !== undefined && network.set_default_locking_mode(defaultIsLocked ? 'disabled' : 'unlocked'),
mtu !== undefined && network.set_MTU(mtu),
nameDescription !== undefined && network.set_name_description(nameDescription),
nameLabel !== undefined && network.set_name_label(nameLabel),
nbd !== undefined &&
@@ -103,6 +107,11 @@ set.params = {
id: {
type: 'string',
},
mtu: {
type: 'integer',
minimum: RFC_MINIMUM_MTU,
optional: true,
},
name_description: {
type: 'string',
minLength: 0,

View File

@@ -72,11 +72,8 @@ async function* makeObjectsStream(iterable, makeResult, json) {
async function sendObjects(iterable, req, res, path = req.path) {
const { query } = req
const { baseUrl } = req
const makeUrl = item => {
const { id } = item
return join(baseUrl, typeof path === 'function' ? path(item) : path, typeof id === 'number' ? String(id) : id)
}
const basePath = join(req.baseUrl, path)
const makeUrl = ({ id }) => join(basePath, typeof id === 'number' ? String(id) : id)
let makeResult
let { fields } = query
@@ -280,36 +277,6 @@ export default class RestApi {
},
}
{
async function vdis(req, res) {
const { object, query } = req
const vdiIds = new Set()
for (const vbdId of object.$VBDs) {
const vbd = app.getObject(vbdId, 'VBD')
const vdiId = vbd.VDI
if (vdiId !== undefined) {
vdiIds.add(vdiId)
}
}
await sendObjects(
handleArray(
Array.from(vdiIds, id => app.getObject(id, ['VDI', 'VDI-snapshot'])),
query.filter,
ifDef(query.limit, Number)
),
req,
res,
({ type }) => type.toLowerCase() + 's'
)
}
for (const collection of ['vms', 'vm-snapshots', 'vm-templates']) {
collections[collection].routes.vdis = vdis
}
}
collections.pools.actions = {
create_vm: withParams(
defer(async ($defer, { xapiObject: { $xapi } }, { affinity, boot, install, template, ...params }, req) => {

View File

@@ -84,6 +84,16 @@ class Description extends Component {
// -----------------------------------------------------------------------------
class Mtu extends Component {
_editMtu = value => editNetwork(this.props.network, { mtu: value })
render() {
const { network } = this.props
return <Number value={network.MTU} onChange={this._editMtu} />
}
}
@connectStore(() => ({
defaultPif: _createGetDefaultPif(),
}))
@@ -330,7 +340,7 @@ const NETWORKS_COLUMNS = [
},
{
name: _('poolNetworkMTU'),
itemRenderer: network => network.MTU,
itemRenderer: network => <Mtu network={network} />,
},
{