mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-27 10:42:28 +02:00
Merge pull request #3027 from tikD1337/fix/ubridge-kernel-datapath-version
Require uBridge >= 1.3.1
This commit is contained in:
commit
fa4b763640
@ -158,10 +158,10 @@ class Hypervisor(UBridgeHypervisor):
|
|||||||
match = re.search(r"ubridge version ([0-9a-z\.]+)", output)
|
match = re.search(r"ubridge version ([0-9a-z\.]+)", output)
|
||||||
if match:
|
if match:
|
||||||
self._version = match.group(1)
|
self._version = match.group(1)
|
||||||
# uBridge >= 1.2.3 is required for the AF_UNIX control
|
# uBridge >= 1.3.1 is required for the kernel datapath:
|
||||||
# channel, marker filters, builtin Ethernet Switch support,
|
# persistent TAP anchors, kernel links, kernel markers and
|
||||||
# and Docker TAP carrier control.
|
# per-interface kernel captures.
|
||||||
minimum_required_version = "1.2.3"
|
minimum_required_version = "1.3.1"
|
||||||
if parse_version(self._version) < parse_version(minimum_required_version):
|
if parse_version(self._version) < parse_version(minimum_required_version):
|
||||||
raise UbridgeError(f"uBridge executable version must be >= {minimum_required_version}")
|
raise UbridgeError(f"uBridge executable version must be >= {minimum_required_version}")
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -168,30 +168,37 @@ async def test_stop_tcp_has_no_socket_to_unlink(tmp_path, monkeypatch):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_requires_ubridge_1_2_3(tmp_path, monkeypatch):
|
@pytest.mark.parametrize(
|
||||||
|
"version",
|
||||||
|
[
|
||||||
|
"1.2.3", # has the tap module, but no kernel dataplane
|
||||||
|
"1.3.0", # no per-interface capture stop_kernel
|
||||||
|
],
|
||||||
|
)
|
||||||
|
async def test_requires_ubridge_1_3_1(tmp_path, monkeypatch, version):
|
||||||
|
|
||||||
hyp = _make("unix", tmp_path, monkeypatch)
|
hyp = _make("unix", tmp_path, monkeypatch)
|
||||||
with patch(
|
with patch(
|
||||||
"gns3server.compute.ubridge.hypervisor.subprocess_check_output",
|
"gns3server.compute.ubridge.hypervisor.subprocess_check_output",
|
||||||
new_callable=AsyncMock,
|
new_callable=AsyncMock,
|
||||||
return_value="ubridge version 1.2.2",
|
return_value=f"ubridge version {version}",
|
||||||
):
|
):
|
||||||
with pytest.raises(UbridgeError, match=r">= 1\.2\.3"):
|
with pytest.raises(UbridgeError, match=r">= 1\.3\.1"):
|
||||||
await hyp._check_ubridge_version()
|
await hyp._check_ubridge_version()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_accepts_ubridge_1_2_3(tmp_path, monkeypatch):
|
async def test_accepts_ubridge_1_3_1(tmp_path, monkeypatch):
|
||||||
|
|
||||||
hyp = _make("unix", tmp_path, monkeypatch)
|
hyp = _make("unix", tmp_path, monkeypatch)
|
||||||
with patch(
|
with patch(
|
||||||
"gns3server.compute.ubridge.hypervisor.subprocess_check_output",
|
"gns3server.compute.ubridge.hypervisor.subprocess_check_output",
|
||||||
new_callable=AsyncMock,
|
new_callable=AsyncMock,
|
||||||
return_value="ubridge version 1.2.3",
|
return_value="ubridge version 1.3.1",
|
||||||
):
|
):
|
||||||
await hyp._check_ubridge_version()
|
await hyp._check_ubridge_version()
|
||||||
|
|
||||||
assert hyp.version == "1.2.3"
|
assert hyp.version == "1.3.1"
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user