Ce contenu n'est pas disponible dans la langue sélectionnée.
8.4. Guest Virtual Machine Memory Allocation
The following procedure shows how to allocate memory for a guest virtual machine. This allocation and assignment works only at boot time and any changes to any of the memory values will not take effect until the next reboot. The maximum memory that can be allocated per guest is 4 TiB, providing that this memory allocation is not more than what the host physical machine resources can provide.
Valid memory units include:
b
orbytes
for bytesKB
for kilobytes (103 or blocks of 1,000 bytes)k
orKiB
for kibibytes (210 or blocks of 1024 bytes)MB
for megabytes (106 or blocks of 1,000,000 bytes)M
orMiB
for mebibytes (220 or blocks of 1,048,576 bytes)GB
for gigabytes (109 or blocks of 1,000,000,000 bytes)G
orGiB
for gibibytes (230 or blocks of 1,073,741,824 bytes)TB
for terabytes (1012 or blocks of 1,000,000,000,000 bytes)T
orTiB
for tebibytes (240 or blocks of 1,099,511,627,776 bytes)
Note that all values will be rounded up to the nearest kibibyte by libvirt, and may be further rounded to the granularity supported by the hypervisor. Some hypervisors also enforce a minimum, such as 4000KiB (or 4000 x 210 or 4,096,000 bytes). The units for this value are determined by the optional attribute
memory unit
, which defaults to the kibibytes (KiB) as a unit of measure where the value given is multiplied by 210 or blocks of 1024 bytes.
In the cases where the guest virtual machine crashes the optional attribute
dumpCore
can be used to control whether the guest virtual machine's memory should be included in the generated coredump (dumpCore='on'
) or not included (dumpCore='off'
). Note that the default setting is on
so if the parameter is not set to off
, the guest virtual machine memory will be included in the coredump file.
The
currentMemory
attribute determines the actual memory allocation for a guest virtual machine. This value can be less than the maximum allocation, to allow for ballooning up the guest virtual machines memory on the fly. If this is omitted, it defaults to the same value as the memory element. The unit attribute behaves the same as for memory.
In all cases for this section, the domain XML needs to be altered as follows:
<domain> <memory unit='KiB' dumpCore='off'>524288</memory> <!-- changes the memory unit to KiB and does not allow the guest virtual machine's memory to be included in the generated coredump file --> <currentMemory unit='KiB'>524288</currentMemory> <!-- makes the current memory unit 524288 KiB --> ... </domain>