test(e2e): give the dynamips routers a detected idle-PC

Without one every c7200 busy-waits a full CPU core for the whole scenario
-- the tests create raw nodes and no template supplies a value (measured:
constant ~100 % per router, up to ~6 minutes per dynamips scenario).

harness.dynamips_idlepc() detects a value through the controller's
auto_idlepc endpoint (the GUI idle-PC finder path: a throwaway project
boots the image, candidate values are validated by measuring actual CPU
usage) and caches it in ~/.cache/gns3-e2e/idlepc.json keyed by the image
checksum, so the cost (~100 s here) is paid once per image, not per run.
GNS3_E2E_IDLEPC overrides detection; any failure returns None and the
scenarios run without one rather than fail on a CPU optimisation.

All four scenarios that boot c7200 routers (dynamips kernel/relay,
ethernet switch kernel/relay) pass the value at creation. Live: detected
0x60189234 for the M11 image (238 s first run including detection); the
routers drop from ~100 % during boot to 3-8 % steady (sampled per
process), and a re-run reports the cached value with no detection.
This commit is contained in:
YueGuobin committed 2026-10-06 00:21:10 +08:00
1 parent f13da59f23
commit e0329ceee6
4 files changed
+101 -10

No files matched your search

+6 -4
View File
@@ -84,13 +84,14 @@ def test_dynamips_kernel_datapath():
if compute.capabilities().get("ubridge_tap") is not True:
pytest.skip("this compute's uBridge cannot create persistent TAPs (ubridge_tap != True)")
image = _pick_image(server)
idlepc = harness.dynamips_idlepc(server, image)
project = compute.create_project("dyn-e2e")
pid = project["project_id"]
t1 = t2 = None
try:
r1 = compute.create_dynamips_router(pid, "E2E-R1", image, SLOTS)
r2 = compute.create_dynamips_router(pid, "E2E-R2", image, SLOTS)
r1 = compute.create_dynamips_router(pid, "E2E-R1", image, SLOTS, idlepc=idlepc)
r2 = compute.create_dynamips_router(pid, "E2E-R2", image, SLOTS, idlepc=idlepc)
r1_id, r2_id = r1["node_id"], r2["node_id"]
t1 = harness.anchor_name(r1_id, *ETH)
t2 = harness.anchor_name(r2_id, *ETH)
@@ -244,13 +245,14 @@ def test_dynamips_relay_control():
server = harness.live_server(kernel=False)
compute = server.compute
image = _pick_image(server)
idlepc = harness.dynamips_idlepc(server, image)
project = compute.create_project("dyn-e2e-relay")
pid = project["project_id"]
t1 = None
try:
r1 = compute.create_dynamips_router(pid, "E2E-R1", image, SLOTS)
r2 = compute.create_dynamips_router(pid, "E2E-R2", image, SLOTS)
r1 = compute.create_dynamips_router(pid, "E2E-R1", image, SLOTS, idlepc=idlepc)
r2 = compute.create_dynamips_router(pid, "E2E-R2", image, SLOTS, idlepc=idlepc)
r1_id, r2_id = r1["node_id"], r2["node_id"]
t1 = harness.anchor_name(r1_id, *ETH)