Commit Graph
523 Commits
Author SHA1 Message Date
YueGuobin 806afec0d8 feat(controller): offer IOU the kernel datapath
Eligibility gains an IOU branch gated on the compute's ubridge_iol_tap
(strict True: an unreported capability keeps the link on the relay), and
a port-level rule: a kernel link is an Ethernet segment, so any endpoint
whose port is not Ethernet (IOU serial) disqualifies the link before it
is dispatched. Without that, a serial link between two capable IOU nodes
would be sent as nio_bridge and fail at the compute.

The IOU NIO routes accept nio_bridge alongside the UDP/TAP/Ethernet NIOs
— without the widening the controller's POST is 422'd before the node
ever sees it, the same trap the QEMU routes hit.
2026-10-06 00:21:09 +08:00
YueGuobin 200c946eef feat(ubridge): probe iol_bridge's TAP-port support
Whether an IOU port can terminate on a persistent TAP (iol_bridge
add_nio_tap) is a capability of its own: the tap module and that command
land independently, so a build may have one without the other. Probed on
a scratch IOL bridge with a scratch TAP — one add/delete cycle, no
iol_bridge start needed (attaching a NIO works on a stopped bridge) —
cached by binary identity, with the scratch bridge id above the per-node
id space the fabric locks (513..1024) so a probe cannot collide with a
running node. Any failure, including an old build's "Unknown command",
means unknown: IOU stays on the relay datapath.

Reported through /capabilities as ubridge_iol_tap, next to ubridge_tap.
2026-10-06 00:21:09 +08:00
YueGuobin 187201a08c feat(controller): offer QEMU the kernel datapath, gated per compute
Kernel eligibility becomes "both endpoints on one compute, each able to
anchor": Docker always (adapters are born as veth pairs), QEMU when that
compute's uBridge can create the persistent TAPs its adapters anchor on. The
question is asked per compute, because the link needs both ends anchored --
so a mixed or half-upgraded deployment degrades to the relay instead of
failing an attach.

probe_tap_support() creates and deletes one throwaway persistent TAP through a
scratch uBridge, cached by binary identity like the tc report; /capabilities
exposes `ubridge_tap` (absent = unknown, which keeps links on the relay).

The compute route for a QEMU adapter NIO took UDPNIO only, so a kernel link
was rejected with 422: its body and response now accept
Union[UDPNIO, BridgeNIO] exactly like Docker's.

Stale "Docker-to-Docker" wording in the config, link and MCP descriptions now
talks about anchors, and docs/features/qemu-kernel-datapath.md documents the
datapath -- verified end-to-end on a real instance: 32/32 kernel-datapath
checks and 29/29 on the relay variant.
2026-10-06 00:21:08 +08:00
YueGuobin b4e4739d52 feat(compute): report uBridge tc capabilities and gate filters on them
Consume uBridge's ebpf_modes contract (feature/tc-window 40c36ae): a
stateful mode is usable iff ebpf=1 and its token is listed; builds
predating the field keep their shipped modes (nth/quota/flow), so the
pre-correction window semantics can never be installed silently.

- gns3server/utils/tc_capabilities.py: shared reply parser, mode
  policy and filter-type mappings (compute and controller gate on the
  same rules)
- gns3server/compute/ubridge/tc_probe.py: standalone probe spawning a
  throwaway uBridge as the server's own user, cached by binary
  identity (path/mtime/size - the version string cannot distinguish
  rebuilds); failures cache as unknown
- GET /v3/compute/capabilities gains ubridge_tc {netem, ebpf,
  ebpf_modes, cbpf}; the controller forwards it (Compute.capabilities)
  and available_filters hides kernel-datapath filter types an endpoint
  compute cannot run (both ends apply their own filters, so one
  incapable compute hides the type); computes without a report keep
  the full list and apply-time 409 stays the guard
- docker: _ubridge_apply_ebpf_drops gates per mode token; the cleanup
  path only sends "off" for modes the build declares
- split DockerVM's kernel-datapath machinery (veth lifecycle, carrier,
  marker primitives, tc filter translation, kernel NIO teardown) into
  compute/docker/docker_kernel_datapath.py (DockerKernelDatapathMixin)
2026-10-06 00:21:08 +08:00
YueGuobin 37d7b9121e feat(docker): wire Docker-to-Docker links through a kernel bridge
Eligible links (both endpoints Docker, same compute, no filters/markers,
stopped nodes, no unix-socket NIO containers) are wired as veth pairs
enslaved into a per-link Linux kernel bridge (gns3 + 11 hex of the link
id, filling IFNAMSIZ) instead of the uBridge UDP relay, so frames flow
entirely in the kernel.

- NIOBridge NIO type: the controller decides the datapath in
  UDPLink._prepare and both computes enslave their deterministic gv*/gc*
  veth pair via uBridge's docker/brctl modules
- carrier/suspend = host-end admin state; both endpoints race-safely
  create/delete the bridge (EEXIST/EBUSY/ENOENT tolerated)
- veth adapters can still attach relay (UDP) links on a running node:
  lazy relay bridge over AF_PACKET on the host end (add_nio_ethernet)
- filters/markers/capture are rejected with explicit errors on this
  datapath (they live in the uBridge relay); vendor unix-socket
  containers are excluded; Server.enable_kernel_datapath is the
  kill-switch (default on)
- host-end veths survive container death and are removed on stop plus
  swept by name on the next start (crash/stale recovery)
2026-10-06 00:21:07 +08:00
Mark Paronyan 306d8fbde4 refactor: remove unused imports 2026-10-03 19:43:58 +03:00
Mark Paronyan 61caa20524 style: sort imports in agent and remaining compute modules 2026-10-02 12:43:26 +03:00
Mark Paronyan 634189d443 style: sort imports in api and utils modules 2026-10-02 12:43:26 +03:00
Mark Paronyan 4ebc941951 style: sort imports in controller API routes 2026-10-02 12:43:26 +03:00
Mark Paronyan a77e06b907 Merge branch '3.1' into ruff/trivia-fixups 2026-10-01 19:58:02 +03:00
Mark Paronyan d356a68987 refactor: replace aliased OSError subclasses 2026-10-01 19:57:44 +03:00
Mark Paronyan 7d0be62da8 style: drop redundant utf-8 encode arguments 2026-10-01 19:57:44 +03:00
Mark Paronyan 7a1e79a8a0 style: parenthesize chained boolean operators 2026-10-01 19:57:43 +03:00
Mark Paronyan 0f66fd6c2b style: remove trailing whitespace 2026-10-01 19:57:41 +03:00
Mark Paronyan 9e5ab02147 style: remove unused noqa directives 2026-10-01 19:57:40 +03:00
grossmj 1456d36bf0 chore(tests): fix mypy errors 2026-10-01 15:22:17 +02:00
Jeremy Grossmann a2cdc14a25 Merge branch '3.1' into image-manager-out-of-sync 2026-10-01 14:44:24 +02:00
Jeremy Grossmann e90be1ebac Merge pull request #2930 from markparonyan/mypy-db-templates-images
fix(typing): resolve the remaining mypy errors (18 modules)
2026-09-29 21:37:14 +02:00
Mark Paronyan bacfab8465 fix(typing): resolve mypy errors in api.routes.controller.pools 2026-09-29 22:02:21 +03:00
Mark Paronyan adf9c15e21 fix(typing): resolve mypy errors in api.routes.controller.projects 2026-09-29 22:02:21 +03:00
Mark Paronyan 323055c486 fix(typing): resolve mypy errors in api.routes.controller.templates 2026-09-29 22:02:20 +03:00
Mark Paronyan bbf4e6aa2c fix(typing): resolve mypy errors in api.routes.controller.images 2026-09-29 22:02:20 +03:00
Mark Paronyan 4361598df0 fix(typing): resolve mypy errors in api.routes.controller.llm_model_configs 2026-09-29 22:02:19 +03:00
Mark Paronyan b1d13edd2d fix(typing): resolve mypy errors in api.routes.controller.users 2026-09-29 22:02:18 +03:00
Mark Paronyan a3cb73da3d fix(typing): resolve mypy errors in api.routes.controller.dependencies.authentication 2026-09-29 21:48:33 +03:00
Jeremy Grossmann 76411f1eb0 Merge pull request #2924 from markparonyan/mypy-api-plus
fix(typing): resolve mypy errors in api + compute.dynamips + compute.iou + compute.vpcs + controller
2026-09-29 13:29:08 +02:00
Jeremy Grossmann e8f49877fc Merge branch '3.1' into mypy-api-routes-controller-1 2026-09-29 13:28:33 +02:00
Jeremy Grossmann 7f4f9eb2d0 Merge branch '3.1' into mypy-api-routes 2026-09-29 13:25:35 +02:00
Jeremy Grossmann 49f1af0962 Merge branch '3.1' into mypy-api-routes-compute-4 2026-09-29 13:23:50 +02:00
Jeremy Grossmann 1f7048d49d Merge branch '3.1' into mypy-api-routes-compute-3 2026-09-29 13:23:05 +02:00
Jeremy Grossmann cbd29ece37 Merge branch '3.1' into mypy-api-routes-compute-2 2026-09-29 13:21:10 +02:00
Jeremy Grossmann 726da8383a Merge branch '3.1' into mypy-agent-gns3_copilot-plus 2026-09-29 13:20:27 +02:00
Jeremy Grossmann 4efc22b7ab Merge branch '3.1' into mypy-api-routes-compute-1 2026-09-29 13:15:30 +02:00
Jeremy Grossmann 563b6080f0 Merge pull request #2923 from markparonyan/mypy-api-routes-controller-2
fix(typing): resolve mypy errors in gns3server.api.routes.controller
2026-09-29 13:13:58 +02:00
Jeremy Grossmann 9e9a778f8b Merge pull request #2912 from markparonyan/mypy-api-controller-routes
fix(typing): resolve mypy errors in api.routes.controller
2026-09-29 12:50:06 +02:00
Jeremy Grossmann ce3911be71 Merge pull request #2911 from markparonyan/mypy-api-compute-routes
fix(typing): resolve mypy errors in api.routes.compute
2026-09-29 12:48:36 +02:00
Mark Paronyan 68368220f2 fix(typing): resolve mypy errors in api.server 2026-09-29 09:38:17 +03:00
Mark Paronyan ebe6dee916 fix(typing): resolve mypy errors in api.routes.controller.snapshots 2026-09-29 09:23:08 +03:00
Mark Paronyan 68d96193ec fix(typing): resolve mypy errors in api.routes.controller.groups 2026-09-29 09:23:07 +03:00
Mark Paronyan c340b18ba2 fix(typing): resolve mypy errors in api.routes.controller.roles 2026-09-29 09:23:07 +03:00
Mark Paronyan 2cf90dfce6 fix(typing): resolve mypy errors in api.routes.controller.privileges 2026-09-29 09:23:07 +03:00
Mark Paronyan 93419fc33a fix(typing): resolve mypy errors in api.routes.controller.nodes 2026-09-29 09:23:07 +03:00
Mark Paronyan 0872576b46 fix(typing): resolve mypy errors in api.routes.controller.acl 2026-09-29 09:23:06 +03:00
Mark Paronyan a648bf3780 fix(typing): resolve mypy errors in api.routes.controller.dependencies.database 2026-09-29 09:23:06 +03:00
Mark Paronyan 58609bae7b fix(typing): resolve mypy errors in api.routes.controller.controller 2026-09-29 09:23:06 +03:00
Mark Paronyan d826285748 fix(typing): resolve mypy errors in api.routes.controller.computes 2026-09-29 09:23:06 +03:00
Mark Paronyan 83b80b8c52 fix(typing): resolve mypy errors in api.routes.compute.virtualbox_nodes 2026-09-29 09:23:05 +03:00
Mark Paronyan a86cae541e fix(typing): resolve mypy errors in api.routes.compute.vpcs_nodes 2026-09-29 09:23:05 +03:00
Mark Paronyan e0c4cb8122 fix(typing): resolve mypy errors in api.routes.compute.vmware_nodes 2026-09-29 09:23:05 +03:00
Mark Paronyan 0ff63bfd90 fix(typing): resolve mypy errors in api.routes.compute.nat_nodes 2026-09-29 09:23:04 +03:00