fix(marker): ride markers on NIO so they survive node restart and project reload

Mirror the packet-filter lifecycle: marker specs now live on the NIO
(next to filters), ride in link_data from controller to compute on
every NIO create/update, and are reapplied by _ubridge_apply_markers
in add_ubridge_udp_connection (bridge creation / node restart) and
update_ubridge_udp_connection (NIO update — following the preceding
reset_packet_filters so markers survive filter changes).

Changes:
- NIO / NIOUDP: _markers property + asdict
- schemas/compute/nios.py: UDPNIO.markers field
- base_manager.create_nio: nio.markers from settings
- PUT /nio routes (vpcs/qemu/docker): nio.markers update
- base_node: _ubridge_apply_markers(bridge_name, nio) iterates
  nio.markers, computes pcap path, calls _ubridge_add_marker_filter
  + MarkerManager.register; called after _ubridge_apply_filters
- controller udp_link: _get_node_markers + _markers_for_node (route
  by capture_node_id); markers in create() and update() link_data
- /markers/start,stop endpoints: mirror spec onto nio.markers so
  the marker survives a subsequent node stop/start without a PUT
- tests: add markers field to NIO data expectations

This covers:
- Node restart: NIO persists, add_ubridge_udp_connection re-applies
- Filter update: reset wipes markers, _ubridge_apply_markers re-adds
- Project reload: create() carries markers in link_data → create_nio
- Immediate create: endpoint sets nio.markers immediately
This commit is contained in:
YueGuobin committed 2026-07-16 00:39:51 +08:00
1 parent 540e1c5678
commit 7c90fa9e64
10 files changed
+123 -2

No files matched your search

+9
View File
@@ -78,6 +78,7 @@ async def test_create(project):
"rport": 2048,
"type": "nio_udp",
"filters": {"delay": [10, 0]},
"markers": {},
"suspend": False,
}, timeout=120)
@@ -87,6 +88,7 @@ async def test_create(project):
"rport": 1024,
"type": "nio_udp",
"filters": {},
"markers": {},
"suspend": False,
}, timeout=120)
@@ -146,6 +148,7 @@ async def test_create_one_side_failure(project):
"rport": 2048,
"type": "nio_udp",
"filters": {},
"markers": {},
"suspend": False,
}, timeout=120)
@@ -155,6 +158,7 @@ async def test_create_one_side_failure(project):
"rport": 1024,
"type": "nio_udp",
"filters": {},
"markers": {},
"suspend": False,
}, timeout=120)
# The link creation has failed we rollback the nio
@@ -345,6 +349,7 @@ async def test_update(project):
"rport": 2048,
"type": "nio_udp",
"suspend": False,
"markers": {},
"filters": {"delay": [10, 0]}
}, timeout=120)
@@ -354,6 +359,7 @@ async def test_update(project):
"rport": 1024,
"type": "nio_udp",
"suspend": False,
"markers": {},
"filters": {}
}, timeout=120)
@@ -365,6 +371,7 @@ async def test_update(project):
"rport": 2048,
"type": "nio_udp",
"suspend": False,
"markers": {},
"filters": {
"frequency_drop": [5],
"bpf": ["icmp[icmptype] == 8"]
@@ -425,6 +432,7 @@ async def test_update_suspend(project):
"rport": 2048,
"type": "nio_udp",
"filters": {"frequency_drop": [-1]},
"markers": {},
"suspend": True
}, timeout=120)
@@ -434,5 +442,6 @@ async def test_update_suspend(project):
"rport": 1024,
"type": "nio_udp",
"filters": {},
"markers": {},
"suspend": True
}, timeout=120)