feat(xo-server/vm.set): dont switch to DMC when changing memory

Fixes #4983
This commit is contained in:
Julien Fontanet
2021-04-12 21:15:55 +02:00
parent cb37f85d8e
commit 70d1537ecc
3 changed files with 29 additions and 1 deletions

View File

@@ -9,6 +9,8 @@
[Host/Load-balancer] Add option to disable migration (PR [#5706](https://github.com/vatesfr/xen-orchestra/pull/5706))
- [VM] Don't switch a VM to use [DMC](https://docs.citrix.com/en-us/xencenter/7-1/dmc-about.html) when changing the memory [#4983](https://github.com/vatesfr/xen-orchestra/issues/4983)
### Bug fixes
> Users must be able to say: “I had this issue, happy to know it's fixed”

View File

@@ -340,7 +340,24 @@ export default {
set: 'memory_dynamic_min',
},
memory: 'memoryMax',
_memory: {
addToLimits: true,
get: vm => +vm.memory_dynamic_max,
preprocess: parseSize,
set(memory, vm) {
return vm.$call('set_memory_limits', vm.memory_static_min, memory, memory, memory)
},
},
memory: {
dispatch(vm) {
const dynamicMin = vm.memory_dynamic_min
const useDmc = dynamicMin !== vm.memory_dynamic_max || dynamicMin !== vm.memory_static_max
return useDmc ? 'memoryMax' : '_memory'
},
},
memoryMax: {
addToLimits: true,
limitName: 'memory',

View File

@@ -192,6 +192,10 @@ export const makeEditObject = specs => {
}
})
if ('dispatch' in spec) {
return spec
}
const { get } = spec
if (get) {
spec.get = normalizeGet(get, name)
@@ -235,6 +239,11 @@ export const makeEditObject = specs => {
return
}
const { dispatch } = spec
if (dispatch) {
return set(value, dispatch(object))
}
const { preprocess } = spec
if (preprocess) {
value = preprocess(value)