refactor: remove local gns3vm support and remove more platform-specific code

This commit is contained in:
grossmj committed 2026-10-31 17:51:37 +07:00
1 parent bad48286a5
commit c7e085e23c
36 files changed
+63 -2739

No files matched your search

-10
View File
@@ -31,7 +31,6 @@ from gns3server.compute.compute_error import (
)
from gns3server.compute.error import ImageMissingError, NodeError
from gns3server.compute.ubridge.ubridge_error import UbridgeError
from gns3server.controller.gns3vm.gns3_vm_error import GNS3VMError
from gns3server.version import __api_version__
from . import (
@@ -115,15 +114,6 @@ async def compute_not_found_error_handler(request: Request, exc: ComputeNotFound
)
@compute_api.exception_handler(GNS3VMError)
async def compute_gns3vm_error_handler(request: Request, exc: GNS3VMError):
log.error(f"Compute GNS3 VM error: {exc}")
return JSONResponse(
status_code=409,
content={"message": str(exc)},
)
@compute_api.exception_handler(ImageMissingError)
async def image_missing_error_handler(request: Request, exc: ImageMissingError):
log.error(f"Compute image missing error: {exc}")
@@ -70,7 +70,6 @@ from . import (
computes,
controller,
drawings,
gns3vm,
groups,
images,
links,
@@ -134,10 +133,6 @@ router.include_router(netmiko.router, prefix="/netmiko", tags=["Netmiko"])
router.include_router(pools.router, prefix="/pools", tags=["Resource pools"])
router.include_router(
gns3vm.router, dependencies=[Depends(get_current_active_user)], deprecated=True, prefix="/gns3vm", tags=["GNS3 VM"]
)
router.include_router(
_llm_router,
prefix="/access",
@@ -1,72 +0,0 @@
#!/usr/bin/env python
#
# Copyright (C) 2020 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
API routes for managing the GNS3 VM.
"""
from typing import List
from fastapi import APIRouter
from fastapi.encoders import jsonable_encoder
from gns3server import schemas
from gns3server.controller import Controller
router = APIRouter()
@router.get("/engines", response_model=List[schemas.GNS3VMEngineInfo])
async def get_engines() -> List[dict]:
"""
Return the list of supported engines for the GNS3VM.
"""
gns3_vm = Controller().instance().gns3vm
return gns3_vm.engine_list()
@router.get("/engines/{engine}/vms", response_model=List[schemas.GNS3VMInfo])
async def get_vms(engine: str) -> List[dict]:
"""
Return all the available VMs for a specific virtualization engine.
"""
vms = await Controller.instance().gns3vm.list(engine)
return vms
@router.get("", response_model=schemas.GNS3VM)
async def get_gns3vm_settings() -> schemas.GNS3VM:
"""
Return the GNS3 VM settings.
"""
return Controller.instance().gns3vm.asdict()
@router.put("", response_model=schemas.GNS3VM, response_model_exclude_unset=True)
async def update_gns3vm_settings(gns3vm_data: schemas.GNS3VM) -> schemas.GNS3VM:
"""
Update the GNS3 VM settings.
"""
controller = Controller().instance()
gns3_vm = controller.gns3vm
await gns3_vm.update_settings(jsonable_encoder(gns3vm_data, exclude_unset=True))
controller.save()
return gns3_vm.asdict()