Skip to content

Commit 975aa79

Browse files
committed
test(perf): Do no parameterize restore tests by snapshot_type
Testing DIFF snapshots for the restore test is not an interesting test permutation, as creating a DIFF vs FULL snapshot only has an impact on the creation. Before a diff snapshot can be restored, it has to be rebased, at which point the result is a full snapshot. So the CI tests related to testing latency of restore with DIFF snapshots do not make much sense (admittedly, there is one extra valloc call in the KVM source [1], as dirty-page tracking will be enabled on the load path, but this hardly warrants an entire new test permutation). [1]: https://github.com/torvalds/linux/blob/a901a3568fd26ca9c4a82d8bc5ed5b3ed844d451/virt/kvm/kvm_main.c#L1626-L1638 Signed-off-by: Patrick Roy <[email protected]>
1 parent f3ce3e1 commit 975aa79

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

tests/integration_tests/performance/test_snapshot_perf.py

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,11 @@ def snapshot_create_producer(
161161
return value
162162

163163

164-
def snapshot_resume_producer(logger, vm_builder, snapshot, snapshot_type, use_ramdisk):
164+
def snapshot_resume_producer(logger, vm_builder, snapshot, use_ramdisk):
165165
"""Produce results for snapshot resume tests."""
166166
microvm, metrics_fifo = vm_builder.build_from_snapshot(
167167
snapshot,
168168
resume=True,
169-
diff_snapshots=snapshot_type == SnapshotType.DIFF,
170169
use_ramdisk=use_ramdisk,
171170
)
172171

@@ -205,7 +204,6 @@ def test_older_snapshot_resume_latency(
205204
restore in current version.
206205
"""
207206
logger = logging.getLogger("old_snapshot_load")
208-
snapshot_type = SnapshotType.FULL
209207
jailer = firecracker_release.jailer()
210208
fc_version = firecracker_release.base_name()[1:]
211209
logger.info("Firecracker version: %s", fc_version)
@@ -229,26 +227,21 @@ def test_older_snapshot_resume_latency(
229227
disks = [vm.rootfs_file]
230228
# Create a snapshot builder from a microvm.
231229
snapshot_builder = SnapshotBuilder(vm)
232-
snapshot = snapshot_builder.create(
233-
disks, rootfs.ssh_key(), snapshot_type, net_ifaces=[iface]
234-
)
230+
snapshot = snapshot_builder.create(disks, rootfs.ssh_key(), net_ifaces=[iface])
235231
vm.kill()
236232

237233
st_core.name = "older_snapshot_resume_latency"
238234
st_core.iterations = SAMPLE_COUNT
239235
st_core.custom["guest_config"] = microvm_cfg.strip(".json")
240236
st_core.custom["io_engine"] = io_engine
241-
st_core.custom["snapshot_type"] = (
242-
"FULL" if snapshot_type == SnapshotType.FULL else "DIFF"
243-
)
237+
st_core.custom["snapshot_type"] = "FULL"
244238

245239
prod = producer.LambdaProducer(
246240
func=snapshot_resume_producer,
247241
func_kwargs={
248242
"logger": logger,
249243
"vm_builder": MicrovmBuilder(bin_cloner_path),
250244
"snapshot": snapshot,
251-
"snapshot_type": snapshot_type,
252245
"use_ramdisk": False,
253246
},
254247
)
@@ -363,13 +356,11 @@ def test_snapshot_create_latency(
363356

364357

365358
@pytest.mark.parametrize("guest_mem_mib", [256, 512])
366-
@pytest.mark.parametrize("snapshot_type", [SnapshotType.FULL, SnapshotType.DIFF])
367359
def test_snapshot_resume_latency(
368360
microvm_factory,
369361
guest_kernel,
370362
rootfs,
371363
guest_mem_mib,
372-
snapshot_type,
373364
io_engine,
374365
st_core,
375366
bin_cloner_path,
@@ -384,7 +375,6 @@ def test_snapshot_resume_latency(
384375
TODO: Multiple microvm sizes must be tested in the async pipeline.
385376
"""
386377
logger = logging.getLogger("snapshot_load")
387-
diff_snapshots = snapshot_type == SnapshotType.DIFF
388378
vcpus = 2
389379
microvm_cfg = f"{vcpus}vcpu_{guest_mem_mib}mb.json"
390380
vm = microvm_factory.build(guest_kernel, rootfs, monitor_memory=False)
@@ -393,7 +383,6 @@ def test_snapshot_resume_latency(
393383
vcpu_count=vcpus,
394384
mem_size_mib=guest_mem_mib,
395385
use_initrd=True,
396-
track_dirty_pages=diff_snapshots,
397386
rootfs_io_engine=io_engine,
398387
)
399388
iface = NetIfaceConfig()
@@ -403,30 +392,26 @@ def test_snapshot_resume_latency(
403392
exit_code, _, _ = vm.ssh.execute_command("ls")
404393
assert exit_code == 0
405394

406-
logger.info("Create %s", snapshot_type)
407395
# Create a snapshot builder from a microvm.
408396
snapshot_builder = SnapshotBuilder(vm)
409397
disks = [vm.rootfs_file]
410398
snapshot = snapshot_builder.create(
411-
disks, rootfs.ssh_key(), snapshot_type, use_ramdisk=True, net_ifaces=[iface]
399+
disks, rootfs.ssh_key(), use_ramdisk=True, net_ifaces=[iface]
412400
)
413401
vm.kill()
414402

415403
st_core.name = "snapshot_resume_latency"
416404
st_core.iterations = SAMPLE_COUNT
417405
st_core.custom["guest_config"] = microvm_cfg.strip(".json")
418406
st_core.custom["io_engine"] = io_engine
419-
st_core.custom["snapshot_type"] = (
420-
"FULL" if snapshot_type == SnapshotType.FULL else "DIFF"
421-
)
407+
st_core.custom["snapshot_type"] = "FULL"
422408

423409
prod = producer.LambdaProducer(
424410
func=snapshot_resume_producer,
425411
func_kwargs={
426412
"logger": logger,
427413
"vm_builder": MicrovmBuilder(bin_cloner_path),
428414
"snapshot": snapshot,
429-
"snapshot_type": snapshot_type,
430415
"use_ramdisk": True,
431416
},
432417
)

0 commit comments

Comments
 (0)