Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tests/framework/microvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,12 @@ def restore_from_snapshot(
resume_vm=resume,
**optional_kwargs,
)

if self.memory_monitor:
response = self.api.machine_config.get()
self.mem_size_bytes = int(response.json()["mem_size_mib"]) * 2**20
self.memory_monitor.start()

# This is not a "wait for boot", but rather a "VM still works after restoration"
if jailed_snapshot.net_ifaces and resume:
self.wait_for_ssh_up()
Expand Down
14 changes: 14 additions & 0 deletions tests/integration_tests/functional/test_balloon.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,9 @@ def test_balloon_snapshot(uvm_plain_any, microvm_factory):
"""
vm = uvm_plain_any
vm.spawn()
# Free page reporting and hinting fragment guest memory VMAs
# making it harder to identify them in the memory monitor.
vm.memory_monitor = None
vm.basic_config(
vcpu_count=2,
mem_size_mib=256,
Expand Down Expand Up @@ -420,6 +423,10 @@ def test_balloon_snapshot(uvm_plain_any, microvm_factory):
snapshot = vm.snapshot_full()
microvm = microvm_factory.build_from_snapshot(snapshot)

# Free page reporting and hinting fragment guest memory VMAs
# making it harder to identify them in the memory monitor.
microvm.memory_monitor = None

# Wait out the polling interval, then get the updated stats.
time.sleep(STATS_POLLING_INTERVAL_S * 2)
stats_after_snap = microvm.api.balloon_stats.get().json()
Expand Down Expand Up @@ -462,6 +469,9 @@ def test_hinting_reporting_snapshot(uvm_plain_any, microvm_factory, method):
"""
vm = uvm_plain_any
vm.spawn()
# Free page reporting and hinting fragment guest memory VMAs
# making it harder to identify them in the memory monitor.
vm.memory_monitor = None
vm.basic_config(
vcpu_count=2,
mem_size_mib=256,
Expand Down Expand Up @@ -509,6 +519,10 @@ def test_hinting_reporting_snapshot(uvm_plain_any, microvm_factory, method):
snapshot = vm.snapshot_full()
microvm = microvm_factory.build_from_snapshot(snapshot)

# Free page reporting and hinting fragment guest memory VMAs
# making it harder to identify them in the memory monitor.
microvm.memory_monitor = None

microvm.ssh.check_output(
"nohup /usr/local/bin/fast_page_fault_helper >/dev/null 2>&1 </dev/null &"
)
Expand Down
7 changes: 6 additions & 1 deletion tests/integration_tests/performance/test_hotplug_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ def uvm_resumed_memhp(
snapshot_type,
)
snapshot = uvm.make_snapshot(snapshot_type)
return microvm_factory.build_from_snapshot(snapshot, uffd_handler_name=uffd_handler)
uvm2 = microvm_factory.build_from_snapshot(snapshot, uffd_handler_name=uffd_handler)
uvm2.memory_monitor = None

return uvm2


@pytest.fixture(
Expand Down Expand Up @@ -372,6 +375,8 @@ def test_snapshot_restore_incremental(uvm_plain_6_1, microvm_factory):
use_snapshot_editor=True,
)
):
uvm.memory_monitor = None

# check checksums of previous cycles
for j in range(i):
_, checksum, _ = uvm.ssh.check_output(f"sha256sum /dev/shm/mem_hp_test_{j}")
Expand Down