feat(xo-server/vm.set memory{,Max}): handle MEMORY_CONSTRAINT_VIOLATION_MAXPIN

Fixes #4978
Fixes #5326
Fixes xoa-support#1187

This error is used when DMC is disabled.
This commit is contained in:
Julien Fontanet
2020-11-30 13:50:58 +01:00
parent eead64ff71
commit 48e82ac15b
2 changed files with 6 additions and 1 deletions

View File

@@ -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”

View File

@@ -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)
)
},