mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-09-07 02:25:21 +03:00
revert IOL port-name override; document custom_adapters instead
_get_container_ifname only names the kernel interface inside the
container's network namespace (single call site: docker move_to_ns) -
IOL never uses that path, and the controller port list never reads it.
Name the ports through the template's custom_adapters instead (the
mechanism SR Linux appliances use for mgmt0/e1-1): adapter N shows as
Ethernet{N/4}/{N%4}, matching the IOS CLI, with no server-side changes.
This commit is contained in:
parent
4c818c6b37
commit
9b55164064
@ -93,7 +93,12 @@ API docs for the auth flow), or in the Web UI under
|
||||
"console_type": "telnet",
|
||||
"environment": "GNS3_IOL_RUNNER=1",
|
||||
"extra_volumes": ["/config"],
|
||||
"memory": 2560
|
||||
"custom_adapters": [
|
||||
{"adapter_number": 0, "port_name": "Ethernet0/0"},
|
||||
{"adapter_number": 1, "port_name": "Ethernet0/1"},
|
||||
{"adapter_number": 2, "port_name": "Ethernet0/2"},
|
||||
{"adapter_number": 3, "port_name": "Ethernet0/3"}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
@ -101,17 +106,20 @@ API docs for the auth flow), or in the Web UI under
|
||||
|---|---|---|
|
||||
| `environment` | `GNS3_IOL_RUNNER=1` | The switch that selects `IOLDockerVM` (skip-init, unix-socket NIO, auto volumes). Optional: `GNS3_IOL_MEMORY=<MB>` (default 2048). |
|
||||
| `extra_volumes` | `["/config"]` | `/tmp/run` is auto-added. **Never add `/tmp`** — it would persist the socket directory into the projects tree and uBridge would reject the too-long AF_UNIX path. |
|
||||
| `custom_adapters` | one entry per adapter | Names each port after the IOL interface it maps to: adapter `N` → `Ethernet{N/4}/{N%4}` (same mechanism SR Linux uses for `mgmt0`/`e1-1`). Raise the list up to `Ethernet7/3` (32 ports, the IOL maximum) when raising `adapters`; adapters beyond the list fall back to `eth{N}`. |
|
||||
| `memory` | optional; `0` (default) = no cap | Unset works — Docker applies no limit. When you do set a cap, keep it at IOL memory + ~512 MB, or the cgroup OOM-killer shoots the router. |
|
||||
| `console_type` | `telnet` | The runner muxes the IOS console onto PID 1 stdio; `docker_exec` is not needed. |
|
||||
| `adapters` | multiple of 4 | IOL port granularity. Ports are shown as `Ethernet0/0`-style (one 4-port unit per adapter range), matching the IOS CLI. |
|
||||
| `adapters` | multiple of 4 | IOL port granularity (one 4-port unit per range). |
|
||||
|
||||
### Verify
|
||||
|
||||
1. Drop a node into a project and start it — the console shows the
|
||||
1. The node's port list shows `Ethernet0/0`… (from the template's
|
||||
`custom_adapters`).
|
||||
2. Drop a node into a project and start it — the console shows the
|
||||
`Linux Unix (i686)` banner within seconds.
|
||||
2. `$XDG_RUNTIME_DIR/gns3/unixio/<node-id>/` contains `s00.sock`… (one
|
||||
3. `$XDG_RUNTIME_DIR/gns3/unixio/<node-id>/` contains `s00.sock`… (one
|
||||
pair per adapter).
|
||||
3. The startup-config lives at
|
||||
4. The startup-config lives at
|
||||
`project-files/docker/<node>/tmp/run/config` (interface names
|
||||
`Ethernet0/0`, not `GigabitEthernet0/0`).
|
||||
|
||||
|
||||
@ -105,15 +105,6 @@ class IOLDockerVM(VendorDockerVM):
|
||||
volumes.append(needed)
|
||||
return volumes
|
||||
|
||||
def _get_container_ifname(self, adapter_number):
|
||||
"""
|
||||
Override: name ports after the IOL interface they map to
|
||||
(Ethernet0/0, Ethernet0/1, … — a new 4-port unit every four
|
||||
adapters), so what the GNS3 UI shows matches the IOS CLI. Wiring is
|
||||
unaffected: the flat adapter number remains the socket index.
|
||||
"""
|
||||
return f"Ethernet{adapter_number // 4}/{adapter_number % 4}"
|
||||
|
||||
async def start(self):
|
||||
|
||||
await self._prepare_iol_runtime()
|
||||
|
||||
@ -177,20 +177,6 @@ def test_iol_memory_knob(compute_project, manager):
|
||||
assert vm._iol_memory == 2048
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Port naming
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def test_ports_are_named_after_iol_interfaces(compute_project, manager):
|
||||
|
||||
vm = _make_vm(compute_project, manager, adapters=8)
|
||||
assert vm._get_container_ifname(0) == "Ethernet0/0"
|
||||
assert vm._get_container_ifname(3) == "Ethernet0/3"
|
||||
# the second 4-port unit starts its own slot numbering
|
||||
assert vm._get_container_ifname(4) == "Ethernet1/0"
|
||||
assert vm._get_container_ifname(7) == "Ethernet1/3"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# create()
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user