From 06a6a0a33283af53c4423084e4a0881f4436b350 Mon Sep 17 00:00:00 2001 From: Brian Candler Date: Wed, 15 Apr 2020 09:41:50 +0100 Subject: [PATCH 1/3] Sort snapshots by (created_at, name) Fixes #1739 --- gns3server/handlers/api/controller/snapshot_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gns3server/handlers/api/controller/snapshot_handler.py b/gns3server/handlers/api/controller/snapshot_handler.py index 513bbe3e..e4008ee9 100644 --- a/gns3server/handlers/api/controller/snapshot_handler.py +++ b/gns3server/handlers/api/controller/snapshot_handler.py @@ -64,7 +64,7 @@ class SnapshotHandler: controller = Controller.instance() project = controller.get_project(request.match_info["project_id"]) snapshots = [s for s in project.snapshots.values()] - response.json(sorted(snapshots, key=lambda s: s.created_at)) + response.json(sorted(snapshots, key=lambda s: (s.created_at, s.name))) @Route.delete( r"/projects/{project_id}/snapshots/{snapshot_id}", From 69986b0d0fbd4a3eb911889a88da490f4aded5c1 Mon Sep 17 00:00:00 2001 From: Brian Candler Date: Wed, 15 Apr 2020 09:46:45 +0100 Subject: [PATCH 2/3] Correct typo "Snasphot" --- .../v2/controller/snapshot/projectsprojectidsnapshots.rst | 4 ++-- .../snapshot/projectsprojectidsnapshotssnapshotid.rst | 2 +- .../projectsprojectidsnapshotssnapshotidrestore.rst | 2 +- gns3server/handlers/api/controller/snapshot_handler.py | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/api/v2/controller/snapshot/projectsprojectidsnapshots.rst b/docs/api/v2/controller/snapshot/projectsprojectidsnapshots.rst index c37b5788..af3ff793 100644 --- a/docs/api/v2/controller/snapshot/projectsprojectidsnapshots.rst +++ b/docs/api/v2/controller/snapshot/projectsprojectidsnapshots.rst @@ -13,7 +13,7 @@ Parameters Response status codes ********************** -- **201**: Snasphot created +- **201**: Snapshot created - **404**: The project doesn't exist Input @@ -54,7 +54,7 @@ Parameters Response status codes ********************** -- **200**: Snasphot list returned +- **200**: Snapshot list returned - **404**: The project doesn't exist Sample session diff --git a/docs/api/v2/controller/snapshot/projectsprojectidsnapshotssnapshotid.rst b/docs/api/v2/controller/snapshot/projectsprojectidsnapshotssnapshotid.rst index bf3a0e59..109cdb74 100644 --- a/docs/api/v2/controller/snapshot/projectsprojectidsnapshotssnapshotid.rst +++ b/docs/api/v2/controller/snapshot/projectsprojectidsnapshotssnapshotid.rst @@ -10,7 +10,7 @@ Delete a snapshot from disk Parameters ********** - **project_id**: Project UUID -- **snapshot_id**: Snasphot UUID +- **snapshot_id**: Snapshot UUID Response status codes ********************** diff --git a/docs/api/v2/controller/snapshot/projectsprojectidsnapshotssnapshotidrestore.rst b/docs/api/v2/controller/snapshot/projectsprojectidsnapshotssnapshotidrestore.rst index 82386f82..ae8f6ce8 100644 --- a/docs/api/v2/controller/snapshot/projectsprojectidsnapshotssnapshotidrestore.rst +++ b/docs/api/v2/controller/snapshot/projectsprojectidsnapshotssnapshotidrestore.rst @@ -10,7 +10,7 @@ Restore a snapshot from disk Parameters ********** - **project_id**: Project UUID -- **snapshot_id**: Snasphot UUID +- **snapshot_id**: Snapshot UUID Response status codes ********************** diff --git a/gns3server/handlers/api/controller/snapshot_handler.py b/gns3server/handlers/api/controller/snapshot_handler.py index 513bbe3e..9138fdc8 100644 --- a/gns3server/handlers/api/controller/snapshot_handler.py +++ b/gns3server/handlers/api/controller/snapshot_handler.py @@ -40,7 +40,7 @@ class SnapshotHandler: input=SNAPSHOT_CREATE_SCHEMA, output=SNAPSHOT_OBJECT_SCHEMA, status_codes={ - 201: "Snasphot created", + 201: "Snapshot created", 404: "The project doesn't exist" }) async def create(request, response): @@ -57,7 +57,7 @@ class SnapshotHandler: "project_id": "Project UUID", }, status_codes={ - 200: "Snasphot list returned", + 200: "Snapshot list returned", 404: "The project doesn't exist" }) def list(request, response): @@ -71,7 +71,7 @@ class SnapshotHandler: description="Delete a snapshot from disk", parameters={ "project_id": "Project UUID", - "snapshot_id": "Snasphot UUID" + "snapshot_id": "Snapshot UUID" }, status_codes={ 204: "Changes have been written on disk", @@ -89,7 +89,7 @@ class SnapshotHandler: description="Restore a snapshot from disk", parameters={ "project_id": "Project UUID", - "snapshot_id": "Snasphot UUID" + "snapshot_id": "Snapshot UUID" }, output=PROJECT_OBJECT_SCHEMA, status_codes={ From 6fd60452c41dab377b73d446afd037d2085295f9 Mon Sep 17 00:00:00 2001 From: fadlytabrani Date: Thu, 16 Apr 2020 00:14:20 +1000 Subject: [PATCH 3/3] Add clipboard support for TigerVnc There's currently no clipboard support for servers running on TigerVnc. TigerVnc clipboard support is provided by vncconfig that needs to be spawned for every display socket. The code changes above provides that functionality --- gns3server/compute/docker/docker_vm.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gns3server/compute/docker/docker_vm.py b/gns3server/compute/docker/docker_vm.py index 25a9b5e7..2317375b 100644 --- a/gns3server/compute/docker/docker_vm.py +++ b/gns3server/compute/docker/docker_vm.py @@ -86,6 +86,7 @@ class DockerVM(BaseNode): self._telnet_servers = [] self._xvfb_process = None self._vnc_process = None + self._vncconfig_process = None self._console_resolution = console_resolution self._console_http_path = console_http_path self._console_http_port = console_http_port @@ -615,6 +616,11 @@ class DockerVM(BaseNode): x11_socket = os.path.join("/tmp/.X11-unix/", "X{}".format(self._display)) await wait_for_file_creation(x11_socket) + # Start vncconfig for tigervnc clipboard support, connection available only after socket creation. + tigervncconfig_path = shutil.which("vncconfig") + if tigervnc_path and tigervncconfig_path: + self._vncconfig_process = await asyncio.create_subprocess_exec(tigervncconfig_path, "-display", ":{}".format(self._display), "-nowin") + # sometimes the VNC process can crash monitor_process(self._vnc_process, self._vnc_callback) @@ -825,6 +831,12 @@ class DockerVM(BaseNode): await self.stop() if self.console_type == "vnc": + if self._vncconfig_process: + try: + self._vncconfig_process.terminate() + await self._vncconfig_process.wait() + except ProcessLookupError: + pass if self._vnc_process: try: self._vnc_process.terminate()