fix(xen-api/setFieldEntry): avoid unnecessary MAP_DUPLICATE_KEY error
Fixes https://xcp-ng.org/forum/post/68761
This commit is contained in:
parent
e56edc70d5
commit
9d9691c5a3
@ -18,6 +18,7 @@
|
||||
- [Settings/Logs] Fix `proxy.getAll: not enough permissions` error with non-admin users (PR [#7249](https://github.com/vatesfr/xen-orchestra/pull/7249))
|
||||
- [Replication/Health Check] Fix `healthCheckVm.add_tag is not a function` error [Forum#69156](https://xcp-ng.org/forum/post/69156)
|
||||
- [Plugin/load-balancer] Prevent unwanted migrations to hosts with low free memory (PR [#7288](https://github.com/vatesfr/xen-orchestra/pull/7288))
|
||||
- Avoid unnecessary `pool.add_to_other_config: Duplicate key` error in XAPI log [Forum#68761](https://xcp-ng.org/forum/post/68761)
|
||||
|
||||
### Packages to release
|
||||
|
||||
@ -37,6 +38,7 @@
|
||||
|
||||
- @xen-orchestra/backups patch
|
||||
- @xen-orchestra/xapi patch
|
||||
- xen-api patch
|
||||
- xo-server patch
|
||||
- xo-server-load-balancer patch
|
||||
- xo-web minor
|
||||
|
@ -361,7 +361,16 @@ export class Xapi extends EventEmitter {
|
||||
if (value === null) {
|
||||
return this.call(`${type}.remove_from_${field}`, ref, entry).then(noop)
|
||||
}
|
||||
|
||||
while (true) {
|
||||
// First, remove any previous value to avoid triggering an unnecessary
|
||||
// `MAP_DUPLICATE_KEY` error which will appear in the XAPI logs
|
||||
//
|
||||
// This is safe because this method does not throw if the entry is missing.
|
||||
//
|
||||
// See https://xcp-ng.org/forum/post/68761
|
||||
await this.call(`${type}.remove_from_${field}`, ref, entry)
|
||||
|
||||
try {
|
||||
await this.call(`${type}.add_to_${field}`, ref, entry, value)
|
||||
return
|
||||
@ -370,7 +379,6 @@ export class Xapi extends EventEmitter {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
await this.call(`${type}.remove_from_${field}`, ref, entry)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user