vmm: Move balloon code from MemoryManager to DeviceManager

Now that we have a new dedicated way of asking for a balloon through the
CLI and the REST API, we can move all the balloon code to the device
manager. This allows us to simplify the memory manager, which is already
quite complex.

It also simplifies the behavior of the balloon resizing command. Instead
of providing the expected size for the RAM, which is complex when memory
zones are involved, it now expects the balloon size. This is a much more
straightforward behavior as it really resizes the balloon to the desired
size. Additionally to the simplication, the benefit of this approach is
that it does not need to be tied to the memory manager at all.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2020-10-14 12:04:42 +02:00
parent 1d479e5e08
commit 3594685279
6 changed files with 55 additions and 57 deletions

View File

@@ -226,7 +226,7 @@ fn resize_api_command(
None
};
let desired_ram_w_balloon: Option<u64> = if let Some(balloon) = balloon {
let desired_balloon: Option<u64> = if let Some(balloon) = balloon {
Some(
balloon
.parse::<ByteSized>()
@@ -240,7 +240,7 @@ fn resize_api_command(
let resize = vmm::api::VmResizeData {
desired_vcpus,
desired_ram,
desired_ram_w_balloon,
desired_balloon,
};
simple_api_command(
@@ -577,7 +577,7 @@ fn main() {
.arg(
Arg::with_name("balloon")
.long("balloon")
.help("New memory with balloon size in bytes (supports K/M/G suffix)")
.help("New balloon size in bytes (supports K/M/G suffix)")
.takes_value(true)
.number_of_values(1),
),