 
   resourceSet = xapi.xo.getData(ref, 'resourceSet')
 
+  if 'memoryMin' of params
+    memoryMin = parseSize(params.memoryMin)
+    yield xapi.call 'VM.set_memory_static_min', ref, "#{memoryMin}"
+    yield xapi.call 'VM.set_memory_dynamic_min', ref, "#{memoryMin}"
+
+  if 'memoryMax' of params
+    memoryMax = parseSize(params.memoryMax)
+    yield xapi.call 'VM.set_memory_static_max', ref, "#{memoryMax}"
+
   # Memory.
   if 'memory' of params
     memory = parseSize(params.memory)

  # Note: static_min ≤ dynamic_min ≤ dynamic_max ≤ static_max
  memory: { type: ['integer', 'string'], optional: true }

  # Kernel arguments for PV VM.
  PV_args: { type: 'string', optional: true }


          "for a running VM"
      )

    if memory > VM.memory.static[1]
      yield xapi.call 'VM.set_memory_static_max', ref, "#{memory}"
    if resourceSet?
      yield @allocateLimitsInResourceSet({
