diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 154c5e87a..5b7ee3c25 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -7,6 +7,8 @@ > Users must be able to say: “Nice enhancement, I'm eager to test it” +- [VM] Handle setting memory when DMC is disabled [#4978](https://github.com/vatesfr/xen-orchestra/issues/4978) & [#5326](https://github.com/vatesfr/xen-orchestra/issues/5326) (PR [#5412](https://github.com/vatesfr/xen-orchestra/pull/5412)) + ### Bug fixes > Users must be able to say: “I had this issue, happy to know it's fixed” diff --git a/packages/xo-server/src/xapi/mixins/vm.js b/packages/xo-server/src/xapi/mixins/vm.js index 60bb61b55..f445ff65d 100644 --- a/packages/xo-server/src/xapi/mixins/vm.js +++ b/packages/xo-server/src/xapi/mixins/vm.js @@ -11,6 +11,9 @@ import { extractOpaqueRef, isVmHvm, isVmRunning, makeEditObject } from '../utils const XEN_VGA_VALUES = ['std', 'cirrus'] const XEN_VIDEORAM_VALUES = [1, 2, 4, 8, 16] +// handle MEMORY_CONSTRAINT_VIOLATION and derivatives like MEMORY_CONSTRAINT_VIOLATION_MAXPIN +const isMemoryConstraintError = e => e.code.startsWith('MEMORY_CONSTRAINT_VIOLATION') + export default { // https://xapi-project.github.io/xen-api/classes/vm.html#checkpoint @cancelable @@ -359,7 +362,7 @@ export default { Math.max(dynamicMax, vm.memory_static_max), dynamicMin, dynamicMax - )::pCatch({ code: 'MEMORY_CONSTRAINT_VIOLATION' }, () => + )::pCatch(isMemoryConstraintError, () => this.call('VM.set_memory_limits', $ref, staticMin, dynamicMax, dynamicMax, dynamicMax) ) },