feat(xo-web/new/network): private network on bond and VLAN (#4682)

This commit is contained in:
BenjiReis
2019-12-03 16:54:19 +01:00
committed by Pierre Donias
parent 1064c04ab8
commit bb18ffd9e7
3 changed files with 23 additions and 13 deletions

View File

@@ -7,6 +7,8 @@
> Users must be able to say: “Nice enhancement, I'm eager to test it”
- [SDN Controller] Allow private network creation on bond and VLAN (PR [#4682](https://github.com/vatesfr/xen-orchestra/pull/4682))
### Bug fixes
> Users must be able to say: “I had this issue, happy to know it's fixed”

View File

@@ -503,6 +503,7 @@ const TRANSFORMS = {
attached: Boolean(obj.currently_attached),
isBondMaster: !isEmpty(obj.bond_master_of),
isBondSlave: obj.bond_slave_of !== 'OpaqueRef:NULL',
device: obj.device,
deviceName: metrics && metrics.device_name,
dns: obj.DNS,

View File

@@ -61,6 +61,23 @@ const Item = ({ label, children, className }) => (
</span>
)
/*
From XAPI doc, a tunnel can only be created on:
- Physical PIF
- Bond master PIF
- VLAN PIF
If and only if the PIF:
- Has an IP configuration
- is NOT a bond slave
For more info see: https://xapi-project.github.io/xapi/design/tunnelling.html
*/
const canSupportPrivateNetwork = (pool, pif) =>
(pif.isBondMaster || pif.physical || pif.vlan !== -1) &&
pif.mode !== 'None' &&
!pif.isBondSlave &&
pif.$host === pool.master
const NewNetwork = decorate([
addSubscriptions({
plugins: subscribePlugins,
@@ -139,19 +156,9 @@ const NewNetwork = decorate([
pifPredicate: (_, { pool }) => pif =>
pif.vlan === -1 && pif.$host === (pool && pool.master),
pifPredicateSdnController: (_, { pool }) => pif =>
pif.physical &&
pif.ip_configuration_mode !== 'None' &&
pif.bond_slave_of === 'OpaqueRef:NULL' &&
pif.$host === (pool && pool.master),
networkPifPredicate: ({ networks }) => (pif, key) => {
const pool = networks[key].pool
return (
pif.physical &&
pif.ip_configuration_mode !== 'None' &&
pif.bond_slave_of === 'OpaqueRef:NULL' &&
pif.$host === (pool !== undefined && pool.master)
)
},
canSupportPrivateNetwork(pool, pif),
networkPifPredicate: ({ networks }) => (pif, key) =>
canSupportPrivateNetwork(networks[key].pool, pif),
networkPoolPredicate: ({ networks }, { pool: rootPool }) => (
pool,
index