Skip to content

Commit

Permalink
[CI][mem_monitor] fix bug for snap-resume tests
Browse files Browse the repository at this point in the history
The memory monitor depends on knowing the size of the
guest memory. This is because we only measure Firecracker's
memory overhead (i.e by excluding the associated guest memory).

Memory monitor is now started in the "basic_config" function which is
the function all tests use for attaching a default config to the
microVM.
The initial guest mem size known to the mem monitor will be the
one set through "basic_config".
If any other subsequent operations modify the size of the guest memory,
the memory monitor needs to be made aware of that.

Ideally we would want to make this mechanism more robust by correlating
the memory monitor to the guest memory without the developer being
required to do this explicitly. The method we could use would be for
the memory monitor thread to call into machine_config to get the size
of guest memory. I am afraid though that by doing that, we will be
adding latency in the memory monitor and possibly miss on memory
exceedances since we would be spending time doing GET API requests.

I propose to leave things function the same way for the moment, since
tests that do not modify the size of guest memory properly should fail.
They did not fail up until now, because we had a bug in the logic that
checks whether there were any threshold exceedance.

Signed-off-by: Diana Popa <[email protected]>
  • Loading branch information
dianpopa committed Jan 5, 2023
1 parent 0171504 commit 1bcc4ab
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tests/framework/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def build(
track_dirty_pages=diff_snapshots,
cpu_template=cpu_template,
)
vm.memory_monitor.guest_mem_mib = microvm_config["mem_size_mib"]
assert vm.api_session.is_status_no_content(response.status_code)

vm.vcpus_count = int(microvm_config["vcpu_count"])
Expand Down

0 comments on commit 1bcc4ab

Please sign in to comment.