Memory

Memory is used for many things:

  • the hypervisor code: this is the Xen executable itself
  • the hypervisor heap: this is needed for per-domain structures and per-vCPU structures
  • the crash kernel: this is needed to collect information after a host crash
  • domain RAM: this is the memory the VM believes it has
  • shadow memory: for HVM guests running on hosts without hardware assisted paging (HAP) Xen uses shadow to optimise page table updates. For all guests shadow is used during live migration for tracking the memory transfer.
  • video RAM for the virtual graphics card

Some of these are constants (e.g. hypervisor code) while some depend on the VM configuration (e.g. domain RAM). Xapi calls the constants “host overhead” and the variables due to VM configuration as “VM overhead”. These overheads are subtracted from free memory on the host when starting, resuming and migrating VMs.

Related XenAPI Classes, Fields and Messages

Classes

NameDescription

Fields

NameDescription
VM.memory_dynamic_max Dynamic maximum (bytes)
VM.memory_dynamic_min Dynamic minimum (bytes)
VM.memory_overhead Virtualization memory overhead (bytes).
VM.memory_static_max Statically-set (i.e. absolute) maximum (bytes). The value of this field at VM start time acts as a hard limit of the amount of memory a guest can use. New values only take effect on reboot.
VM.memory_static_min Statically-set (i.e. absolute) mininum (bytes). The value of this field indicates the least amount of memory this VM can boot with without crashing.
VM.memory_target Dynamically-set memory target (bytes). The value of this field indicates the current target for memory available to this VM.
host.memory_overhead Virtualization memory overhead (bytes).
host_metrics.memory_free Free host memory (bytes)
host_metrics.memory_total Total host memory (bytes)

Messages

NameDescription
VM.assert_can_boot_hereReturns an error if the VM could not boot on this host for some reason
VM.compute_memory_overheadComputes the virtualization memory overhead of a VM.
VM.get_cooperativeReturn true if the VM is currently 'co-operative' i.e. is expected to reach a balloon target and actually has done
VM.maximise_memoryReturns the maximum amount of guest memory which will fit, together with overheads, in the supplied amount of physical memory. If 'exact' is true then an exact calculation is performed using the VM's current settings. If 'exact' is false then a more conservative approximation is used
VM.set_memorySet the memory allocation of this VM. Sets all of memory_static_max, memory_dynamic_min, and memory_dynamic_max to the given value, and leaves memory_static_min untouched.
VM.set_memory_dynamic_maxSet the value of the memory_dynamic_max field
VM.set_memory_dynamic_minSet the value of the memory_dynamic_min field
VM.set_memory_dynamic_rangeSet the minimum and maximum amounts of physical memory the VM is allowed to use.
VM.set_memory_limitsSet the memory limits of this VM.
VM.set_memory_static_maxSet the value of the memory_static_max field
VM.set_memory_static_minSet the value of the memory_static_min field
VM.set_memory_static_rangeSet the static (ie boot-time) range of virtual memory that the VM is allowed to use.
VM.set_memory_target_liveSet the memory target for a running VM
VM.wait_memory_target_liveWait for a running VM to reach its current memory target
host.compute_free_memoryComputes the amount of free memory on the host.
host.compute_memory_overheadComputes the virtualization memory overhead of a host.