Skip to content

Commit caf66bb

Browse files
authored
Merge branch 'main' into serial-steal-time-tests
2 parents fa60d3e + 880e146 commit caf66bb

File tree

3 files changed

+42
-49
lines changed

3 files changed

+42
-49
lines changed

tests/framework/microvm.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,14 @@ def kill(self):
313313
if self.screen_pid:
314314
os.kill(self.screen_pid, signal.SIGKILL)
315315
except:
316-
LOG.error(
316+
msg = (
317317
"Failed to kill Firecracker Process. Did it already die (or did the UFFD handler process die and take it down)?"
318+
if self.uffd_handler
319+
else "Failed to kill Firecracker Process. Did it already die?"
318320
)
319-
LOG.error(self.log_data)
321+
322+
self._dump_debug_information(msg)
323+
320324
raise
321325

322326
# if microvm was spawned then check if it gets killed
@@ -1058,7 +1062,9 @@ def ssh_iface(self, iface_idx=0):
10581062
user="root",
10591063
host=guest_ip,
10601064
control_path=Path(self.chroot()) / f"ssh-{iface_idx}.sock",
1061-
on_error=self._dump_debug_information,
1065+
on_error=lambda exc: self._dump_debug_information(
1066+
f"Failure executing command via SSH in microVM: {exc}"
1067+
),
10621068
)
10631069
self._connections.append(connection)
10641070
return connection
@@ -1080,17 +1086,18 @@ def thread_backtraces(self):
10801086
)
10811087
return "\n".join(backtraces)
10821088

1083-
def _dump_debug_information(self, exc: Exception):
1089+
def _dump_debug_information(self, what: str):
10841090
"""
10851091
Dumps debug information about this microvm
10861092
10871093
Used for example when running a command inside the guest via `SSHConnection.check_output` fails.
10881094
"""
1089-
print(
1090-
f"Failure executing command via SSH in microVM: {exc}\n\n"
1091-
f"Firecracker logs:\n{self.log_data}\n"
1092-
f"Thread backtraces:\n{self.thread_backtraces}"
1093-
)
1095+
LOG.error(what)
1096+
LOG.error("Firecracker logs:\n%s", self.log_data)
1097+
if self.uffd_handler:
1098+
LOG.error("Uffd logs:\n%s", self.uffd_handler.log_data)
1099+
if not self._killed:
1100+
LOG.error("Thread backtraces:\n%s", self.thread_backtraces)
10941101

10951102
def wait_for_ssh_up(self):
10961103
"""Wait for guest running inside the microVM to come up and respond."""

tests/integration_tests/performance/test_snapshot_ab.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,29 @@ def test_population_latency(
249249
break
250250
else:
251251
raise RuntimeError("UFFD handler did not print population latency after 5s")
252+
253+
254+
def test_snapshot_create_latency(
255+
microvm_factory,
256+
guest_kernel_linux_5_10,
257+
rootfs,
258+
metrics,
259+
):
260+
"""Measure the latency of creating a Full snapshot"""
261+
262+
vm = microvm_factory.build(guest_kernel_linux_5_10, rootfs, monitor_memory=False)
263+
vm.spawn()
264+
vm.basic_config(vcpu_count=2, mem_size_mib=512)
265+
vm.start()
266+
vm.pin_threads(0)
267+
268+
metrics.set_dimensions(
269+
{**vm.dimensions, "performance_test": "test_snapshot_create_latency"}
270+
)
271+
272+
for _ in range(ITERATIONS):
273+
vm.snapshot_full()
274+
fc_metrics = vm.flush_metrics()
275+
276+
value = fc_metrics["latencies_us"]["full_create_snapshot"] / USEC_IN_MSEC
277+
metrics.put_metric("latency", value, "Milliseconds")

tests/integration_tests/performance/test_snapshot_perf.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)