diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 2301a1e22..e95b72613 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -15,6 +15,7 @@ > Users must be able to say: “I had this issue, happy to know it's fixed” - [Remotes/NFS] Only mount with `vers=3` when no other options [#4940](https://github.com/vatesfr/xen-orchestra/issues/4940) (PR [#5354](https://github.com/vatesfr/xen-orchestra/pull/5354)) +- [VM/network] Don't change VIF's locking mode automatically (PR [#5357](https://github.com/vatesfr/xen-orchestra/pull/5357)) ### Packages to release diff --git a/packages/xo-server/src/api/vif.js b/packages/xo-server/src/api/vif.js index 9ee374329..bba8d8cfb 100644 --- a/packages/xo-server/src/api/vif.js +++ b/packages/xo-server/src/api/vif.js @@ -119,7 +119,7 @@ export async function set({ mac, currently_attached: attached, ipv4_allowed: newIpAddresses, - locking_mode: lockingMode, + locking_mode: lockingMode ?? vif.lockingMode, qos_algorithm_type: rateLimit != null ? 'ratelimit' : undefined, qos_algorithm_params: rateLimit != null ? { kbps: String(rateLimit) } : undefined, diff --git a/packages/xo-server/src/xapi/mixins/networking.js b/packages/xo-server/src/xapi/mixins/networking.js index 616347a62..95d1f2c2f 100644 --- a/packages/xo-server/src/xapi/mixins/networking.js +++ b/packages/xo-server/src/xapi/mixins/networking.js @@ -1,5 +1,3 @@ -import { isEmpty } from '../../utils' - import { makeEditObject } from '../utils' export default { @@ -26,38 +24,8 @@ export default { await this._disconnectVif(this.getObject(vifId)) }, editVif: makeEditObject({ - ipv4Allowed: { - get: true, - set: [ - 'ipv4Allowed', - function (value, vif) { - const lockingMode = - isEmpty(value) && isEmpty(vif.ipv6_allowed) - ? 'network_default' - : 'locked' - - if (lockingMode !== vif.locking_mode) { - return vif.set_locking_mode(lockingMode) - } - }, - ], - }, - ipv6Allowed: { - get: true, - set: [ - 'ipv6Allowed', - function (value, vif) { - const lockingMode = - isEmpty(value) && isEmpty(vif.ipv4_allowed) - ? 'network_default' - : 'locked' - - if (lockingMode !== vif.locking_mode) { - return vif.set_locking_mode(lockingMode) - } - }, - ], - }, + ipv4Allowed: true, + ipv6Allowed: true, lockingMode: { set: (value, vif) => vif.set_locking_mode(value), },