Skip to content

Commit

Permalink
fix(xo-web/new/network): correct type for vlan
Browse files Browse the repository at this point in the history
BREAKING CHANGE: API method `network.create` no longer accepts a `string` for `vlan` param.

Fixes https://xcp-ng.org/forum/post/62090

Either `number` or `undefined`, not an empty string.
  • Loading branch information
julien-f committed May 12, 2023
1 parent 73d88cc commit 53461b8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
> Users must be able to say: “I had this issue, happy to know it's fixed”
- [VM] Fix `VBD_IS_EMPTY` error when converting to template [Forum#61653](https://xcp-ng.org/forum/post/61653) (PR [#6808](https://github.com/vatesfr/xen-orchestra/pull/6808))
- -[New/Network] Fix `invalid parameter error` when not providing a VLAN [Forum#62090](https://xcp-ng.org/forum/post/62090) (PR [#6829](https://github.com/vatesfr/xen-orchestra/pull/6829))

### Packages to release

Expand All @@ -30,5 +31,6 @@
<!--packages-start-->

- xo-server patch
- xo-web patch

<!--packages-end-->
4 changes: 2 additions & 2 deletions packages/xo-server/src/api/network.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export async function create({ pool, name, description, pif, mtu = 1500, vlan =
description,
pifId: pif && this.getObject(pif, 'PIF')._xapiId,
mtu: +mtu,
vlan: +vlan,
vlan,
})

if (nbd) {
Expand All @@ -27,7 +27,7 @@ create.params = {
description: { type: 'string', minLength: 0, optional: true },
pif: { type: 'string', optional: true },
mtu: { type: 'integer', optional: true },
vlan: { type: ['integer', 'string'], optional: true },
vlan: { type: 'integer', optional: true },
}

create.resolve = {
Expand Down
4 changes: 2 additions & 2 deletions packages/xo-web/src/xo-app/new/network/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ const NewNetwork = decorate([
networks,
pif,
pifs,
vlan,
} = state

let { mtu } = state
let { mtu, vlan } = state
mtu = mtu === '' ? undefined : +mtu
vlan = vlan === '' ? undefined : +vlan

return bonded
? createBondedNetwork({
Expand Down

0 comments on commit 53461b8

Please sign in to comment.