diff --git a/tests/framework/microvm.py b/tests/framework/microvm.py index c8babc9f54b..89337def7ad 100644 --- a/tests/framework/microvm.py +++ b/tests/framework/microvm.py @@ -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() diff --git a/tests/integration_tests/functional/test_balloon.py b/tests/integration_tests/functional/test_balloon.py index 541815dae3c..9741ffd820d 100644 --- a/tests/integration_tests/functional/test_balloon.py +++ b/tests/integration_tests/functional/test_balloon.py @@ -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, @@ -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() @@ -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, @@ -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