feat(xo-server-sdn-controller): MTU configurable for private networks (#4491)

This commit is contained in:
BenjiReis 2019-09-20 11:19:18 +02:00 committed by Julien Fontanet
parent 30a6877f8a
commit 1833f9ffdf
4 changed files with 20 additions and 13 deletions

View File

@ -10,6 +10,7 @@
- [VM/disks] Don't hide disks that are attached to the same VM twice [#4400](https://github.com/vatesfr/xen-orchestra/issues/4400) (PR [#4414](https://github.com/vatesfr/xen-orchestra/pull/4414))
- [VM/console] Add a button to connect to the VM via the local SSH client (PR [#4415](https://github.com/vatesfr/xen-orchestra/pull/4415))
- [SDN Controller] Add possibility to encrypt private networks (PR [#4441](https://github.com/vatesfr/xen-orchestra/pull/4441))
- [SDN Controller] Ability to configure MTU for private networks (PR [#4491](https://github.com/vatesfr/xen-orchestra/pull/4491))
### Bug fixes

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View File

@ -208,6 +208,7 @@ class SDNController extends EventEmitter {
const createPrivateNetwork = params =>
this._createPrivateNetwork({
encrypted: false,
mtu: 0,
...params,
vni: ++this._prevVni,
})
@ -221,6 +222,7 @@ class SDNController extends EventEmitter {
encapsulation: { type: 'string' },
pifId: { type: 'string' },
encrypted: { type: 'boolean', optional: true },
mtu: { type: 'integer', optional: true },
}
createPrivateNetwork.resolve = {
xoPool: ['poolId', 'pool', ''],
@ -229,7 +231,7 @@ class SDNController extends EventEmitter {
// Expose method to create cross-pool private network
const createCrossPoolPrivateNetwork = params =>
this._createCrossPoolPrivateNetwork({ encrypted: false, ...params })
this._createCrossPoolPrivateNetwork({ encrypted: false, mtu: 0, ...params })
createCrossPoolPrivateNetwork.description =
'Creates a cross-pool private network on selected pools'
@ -250,6 +252,7 @@ class SDNController extends EventEmitter {
},
},
encrypted: { type: 'boolean', optional: true },
mtu: { type: 'integer', optional: true },
}
this._unsetApiMethods = this._xo.addApiMethods({
@ -410,6 +413,7 @@ class SDNController extends EventEmitter {
xoPif,
vni,
encrypted,
mtu,
}) {
const pool = this._xo.getXapiObject(xoPool)
await this._setPoolControllerIfNeeded(pool)
@ -420,7 +424,7 @@ class SDNController extends EventEmitter {
const privateNetworkRef = await pool.$xapi.call('network.create', {
name_label: networkName,
name_description: networkDescription,
MTU: 0,
MTU: mtu,
other_config: {
// Set `automatic` to false so XenCenter does not get confused
// See: https://citrix.github.io/xenserver-sdk/#network
@ -471,6 +475,7 @@ class SDNController extends EventEmitter {
encapsulation,
xoPifIds,
encrypted,
mtu,
}) {
const uuid = uuidv4()
const crossPoolNetwork = {
@ -500,6 +505,7 @@ class SDNController extends EventEmitter {
xoPif,
vni,
encrypted,
mtu,
})
const network = pool.$xapi.getObjectByRef(poolNetwork.network)

View File

@ -218,6 +218,7 @@ const NewNetwork = decorate([
encapsulation: encapsulation,
xoPifIds: pifIds,
encrypted,
mtu: mtu !== '' ? +mtu : undefined,
})
})()
: createPrivateNetwork({
@ -227,6 +228,7 @@ const NewNetwork = decorate([
encapsulation: encapsulation,
pifId: pif.id,
encrypted,
mtu: mtu !== '' ? +mtu : undefined,
})
: createNetwork({
description,
@ -343,6 +345,15 @@ const NewNetwork = decorate([
type='text'
value={description}
/>
<label>{_('newNetworkMtu')}</label>
<input
className='form-control'
name='mtu'
onChange={effects.linkState}
placeholder={formatMessage(messages.newNetworkDefaultMtu)}
type='text'
value={mtu}
/>
{isPrivate ? (
<div>
<label>{_('newNetworkEncapsulation')}</label>
@ -423,17 +434,6 @@ const NewNetwork = decorate([
</div>
) : (
<div>
<label>{_('newNetworkMtu')}</label>
<input
className='form-control'
name='mtu'
onChange={effects.linkState}
placeholder={formatMessage(
messages.newNetworkDefaultMtu
)}
type='text'
value={mtu}
/>
{bonded ? (
<div>
<label>{_('newNetworkBondMode')}</label>