Skip to content

Commit 73c5678

Browse files
authored
Merge branch 'main' into kvm-bindings-0.8.0-again
2 parents 6e6b4e6 + 8859726 commit 73c5678

10 files changed

+51
-6
lines changed

tests/integration_tests/functional/test_api.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,8 +1167,7 @@ def test_get_full_config_after_restoring_snapshot(microvm_factory, uvm_nano):
11671167
snapshot = uvm_nano.snapshot_full()
11681168
uvm2 = microvm_factory.build()
11691169
uvm2.spawn()
1170-
uvm2.restore_from_snapshot(snapshot)
1171-
uvm2.resume()
1170+
uvm2.restore_from_snapshot(snapshot, resume=True)
11721171

11731172
expected_cfg = setup_cfg.copy()
11741173

tests/integration_tests/functional/test_balloon.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,7 @@ def test_balloon_snapshot(microvm_factory, guest_kernel, rootfs):
479479
snapshot = vm.snapshot_full()
480480
microvm = microvm_factory.build()
481481
microvm.spawn()
482-
microvm.restore_from_snapshot(snapshot)
483-
microvm.resume()
482+
microvm.restore_from_snapshot(snapshot, resume=True)
484483

485484
microvm.wait_for_up()
486485

tests/integration_tests/functional/test_cpu_features.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@ def test_cpu_template(uvm_plain_any, cpu_template, microvm_factory):
671671
restored_vm = microvm_factory.build()
672672
restored_vm.spawn()
673673
restored_vm.restore_from_snapshot(snapshot, resume=True)
674+
restored_vm.wait_for_up()
674675
check_masked_features(restored_vm, cpu_template)
675676
check_enabled_features(restored_vm, cpu_template)
676677

tests/integration_tests/functional/test_cpu_features_aarch64.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def test_cpu_features_with_static_template(
114114
restored_vm = microvm_factory.build()
115115
restored_vm.spawn()
116116
restored_vm.restore_from_snapshot(snapshot, resume=True)
117+
restored_vm.wait_for_up()
117118
_check_cpu_features_arm(restored_vm, guest_kv, "v1n1")
118119

119120

@@ -143,4 +144,5 @@ def test_cpu_features_with_custom_template(
143144
restored_vm = microvm_factory.build()
144145
restored_vm.spawn()
145146
restored_vm.restore_from_snapshot(snapshot, resume=True)
147+
restored_vm.wait_for_up()
146148
_check_cpu_features_arm(restored_vm, guest_kv, custom_cpu_template["name"])

tests/integration_tests/functional/test_mmds.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ def _validate_mmds_snapshot(
9393
kwargs["jailer_binary_path"] = jailer_binary_path
9494
microvm = microvm_factory.build(**kwargs)
9595
microvm.spawn()
96-
microvm.restore_from_snapshot(snapshot)
97-
microvm.resume()
96+
microvm.restore_from_snapshot(snapshot, resume=True)
97+
microvm.wait_for_up()
9898

9999
ssh_connection = microvm.ssh
100100

tests/integration_tests/functional/test_rng.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def test_rng_snapshot(uvm_with_rng, microvm_factory):
7272
new_vm = microvm_factory.build()
7373
new_vm.spawn()
7474
new_vm.restore_from_snapshot(snapshot, resume=True)
75+
new_vm.wait_for_up()
7576
check_entropy(new_vm.ssh)
7677

7778

tests/integration_tests/functional/test_snapshot_basic.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,45 @@ def _get_guest_drive_size(ssh_connection, guest_dev_name="/dev/vdb"):
5151
return lines[1].strip()
5252

5353

54+
def test_resume_after_restoration(uvm_nano, microvm_factory):
55+
"""Tests snapshot is resumable after restoration.
56+
57+
Check that a restored microVM is resumable by calling PATCH /vm with Resumed
58+
after PUT /snapshot/load with `resume_vm=False`.
59+
"""
60+
vm = uvm_nano
61+
vm.add_net_iface()
62+
vm.start()
63+
vm.wait_for_up()
64+
65+
snapshot = vm.snapshot_full()
66+
67+
restored_vm = microvm_factory.build()
68+
restored_vm.spawn()
69+
restored_vm.restore_from_snapshot(snapshot)
70+
restored_vm.resume()
71+
restored_vm.wait_for_up()
72+
73+
74+
def test_resume_at_restoration(uvm_nano, microvm_factory):
75+
"""Tests snapshot is resumable at restoration.
76+
77+
Check that a restored microVM is resumable by calling PUT /snapshot/load
78+
with `resume_vm=True`.
79+
"""
80+
vm = uvm_nano
81+
vm.add_net_iface()
82+
vm.start()
83+
vm.wait_for_up()
84+
85+
snapshot = vm.snapshot_full()
86+
87+
restored_vm = microvm_factory.build()
88+
restored_vm.spawn()
89+
restored_vm.restore_from_snapshot(snapshot, resume=True)
90+
restored_vm.wait_for_up()
91+
92+
5493
def test_snapshot_current_version(uvm_nano):
5594
"""Tests taking a snapshot at the version specified in Cargo.toml
5695
@@ -199,6 +238,7 @@ def test_patch_drive_snapshot(uvm_nano, microvm_factory):
199238
vm = microvm_factory.build()
200239
vm.spawn()
201240
vm.restore_from_snapshot(snapshot, resume=True)
241+
vm.wait_for_up()
202242

203243
# Attempt to connect to resumed microvm and verify the new microVM has the
204244
# right scratch drive.

tests/integration_tests/functional/test_vsock.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ def test_vsock_transport_reset(
203203
vm2 = microvm_factory.build()
204204
vm2.spawn()
205205
vm2.restore_from_snapshot(snapshot, resume=True)
206+
vm2.wait_for_up()
206207

207208
# Check that vsock device still works.
208209
# Test guest-initiated connections.

tests/integration_tests/performance/test_huge_pages.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ def test_ept_violation_count(
230230

231231
with ftrace_events("kvm:*"):
232232
vm.restore_from_snapshot(snapshot, resume=True, uffd_path=SOCKET_PATH)
233+
vm.wait_for_up()
233234

234235
# Verify if guest can run commands, and also wake up the fast page fault helper to trigger page faults.
235236
rc, _, _ = vm.ssh.run(f"kill -s {signal.SIGUSR1} {pid}")

tests/integration_tests/security/test_vulnerabilities.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ def restore(firecracker=None, jailer=None):
135135
dst_vm.spawn()
136136
# Restore the destination VM from the snapshot
137137
dst_vm.restore_from_snapshot(snapshot, resume=True)
138+
dst_vm.wait_for_up()
138139
dst_vm.cpu_template = microvm.cpu_template
139140

140141
return dst_vm

0 commit comments

Comments
 (0)