vmm: Add 'hotplug_size' to memory zones

In anticipation for resizing support of an individual memory zone,
this commit introduces a new option 'hotplug_size' to '--memory-zone'
parameter. This defines the amount of memory that can be added through
each specific memory zone.

Because memory zone resize is tied to virtio-mem, make sure the user
selects 'virtio-mem' hotplug method, otherwise return an error.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2020-09-10 12:20:22 +02:00
parent 30ff7e108f
commit c645a72c17
5 changed files with 40 additions and 5 deletions

View file

@ -112,8 +112,7 @@ _Example_
Amount of memory that can be dynamically added to the VM.
Value is an unsigned integer of 64 bits. A value of 0 simply means that no
memory can be added to the VM.
Value is an unsigned integer of 64 bits. A value of 0 is invalid.
_Example_
@ -149,11 +148,12 @@ struct MemoryZoneConfig {
shared: bool,
hugepages: bool,
host_numa_node: Option<u32>,
hotplug_size: Option<u64>,
}
```
```
--memory-zone <memory-zone> User defined memory zone parameters "size=<guest_memory_region_size>,file=<backing_file>,shared=on|off,hugepages=on|off,host_numa_node=<node_id>,id=<zone_identifier>"
--memory-zone <memory-zone> User defined memory zone parameters "size=<guest_memory_region_size>,file=<backing_file>,shared=on|off,hugepages=on|off,host_numa_node=<node_id>,id=<zone_identifier>,hotplug_size=<hotpluggable_memory_size>"
```
This parameter expects one or more occurences, allowing for a list of memory
@ -288,6 +288,21 @@ _Example_
--memory-zone id=mem0,size=1G,host_numa_node=0
```
### `hotplug_size`
Amount of memory that can be dynamically added to the memory zone. Since
`virtio-mem` is the only way of resizing a memory zone, one must specify
the `hotplug_method=virtio-mem` to the `--memory` parameter.
Value is an unsigned integer of 64 bits. A value of 0 is invalid.
_Example_
```
--memory size=0,hotplug_method=virtio-mem
--memory-zone id=mem0,size=1G,hotplug_size=1G
```
## NUMA settings
`NumaConfig` or what is known as `--numa` from the CLI perspective has been