-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: integ test for being able to resnapshot dirty pages ater failure
After having a failure during snapshot we're trying to do it again and expect all the dirty pages to be snapshotted on the second attempt if it succeeds. Signed-off-by: Roman Kovtyukh <HelloDearGrandma@gmail.com> Co-authored-by: Pablo Barbáchano <pablob@amazon.com>
- Loading branch information
1 parent
74fd6b0
commit 97ad1c8
Showing
2 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
tests/integration_tests/functional/test_snapshot_not_loosing_dirty_pages.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
"""Test that the no dirty pages lost in case of error during snapshot creation.""" | ||
|
||
import subprocess | ||
import time | ||
from pathlib import Path | ||
|
||
|
||
def test_not_loosing_dirty_pages_on_snapshot_failure(uvm_plain, microvm_factory): | ||
""" | ||
Test that in case of error during snapshot creation no dirty pages were lost. | ||
""" | ||
vm_mem_size = 128 | ||
uvm = uvm_plain | ||
uvm.spawn() | ||
uvm.basic_config(mem_size_mib=vm_mem_size, track_dirty_pages=True) | ||
uvm.add_net_iface() | ||
uvm.start() | ||
uvm.ssh.run("true") | ||
|
||
chroot = Path(uvm.chroot()) | ||
|
||
# Create a large file, so we run out of space (ENOSPC) during the snapshot | ||
# Assumes a Docker /srv tmpfs of 1G, derived by trial and error | ||
fudge = chroot / "fudge" | ||
subprocess.check_call(f"fallocate -l 550M {fudge}", shell=True) | ||
|
||
try: | ||
uvm.snapshot_diff() | ||
except RuntimeError: | ||
msg = "No space left on device" | ||
uvm.check_log_message(msg) | ||
else: | ||
assert False, "This should fail" | ||
|
||
fudge.unlink() | ||
|
||
# Now there is enough space for it to work | ||
snap2 = uvm.snapshot_diff() | ||
|
||
vm2 = microvm_factory.build() | ||
vm2.spawn() | ||
vm2.restore_from_snapshot(snap2, resume=True) | ||
vm2.ssh.run("true") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters