mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-24 15:58:08 +00:00
Merge branch 'master' into 2.2
This commit is contained in:
commit
4ddd45f788
@ -13,7 +13,7 @@ Parameters
|
|||||||
|
|
||||||
Response status codes
|
Response status codes
|
||||||
**********************
|
**********************
|
||||||
- **201**: Snasphot created
|
- **201**: Snapshot created
|
||||||
- **404**: The project doesn't exist
|
- **404**: The project doesn't exist
|
||||||
|
|
||||||
Input
|
Input
|
||||||
@ -54,7 +54,7 @@ Parameters
|
|||||||
|
|
||||||
Response status codes
|
Response status codes
|
||||||
**********************
|
**********************
|
||||||
- **200**: Snasphot list returned
|
- **200**: Snapshot list returned
|
||||||
- **404**: The project doesn't exist
|
- **404**: The project doesn't exist
|
||||||
|
|
||||||
Sample session
|
Sample session
|
||||||
|
@ -10,7 +10,7 @@ Delete a snapshot from disk
|
|||||||
Parameters
|
Parameters
|
||||||
**********
|
**********
|
||||||
- **project_id**: Project UUID
|
- **project_id**: Project UUID
|
||||||
- **snapshot_id**: Snasphot UUID
|
- **snapshot_id**: Snapshot UUID
|
||||||
|
|
||||||
Response status codes
|
Response status codes
|
||||||
**********************
|
**********************
|
||||||
|
@ -10,7 +10,7 @@ Restore a snapshot from disk
|
|||||||
Parameters
|
Parameters
|
||||||
**********
|
**********
|
||||||
- **project_id**: Project UUID
|
- **project_id**: Project UUID
|
||||||
- **snapshot_id**: Snasphot UUID
|
- **snapshot_id**: Snapshot UUID
|
||||||
|
|
||||||
Response status codes
|
Response status codes
|
||||||
**********************
|
**********************
|
||||||
|
@ -86,6 +86,7 @@ class DockerVM(BaseNode):
|
|||||||
self._telnet_servers = []
|
self._telnet_servers = []
|
||||||
self._xvfb_process = None
|
self._xvfb_process = None
|
||||||
self._vnc_process = None
|
self._vnc_process = None
|
||||||
|
self._vncconfig_process = None
|
||||||
self._console_resolution = console_resolution
|
self._console_resolution = console_resolution
|
||||||
self._console_http_path = console_http_path
|
self._console_http_path = console_http_path
|
||||||
self._console_http_port = console_http_port
|
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))
|
x11_socket = os.path.join("/tmp/.X11-unix/", "X{}".format(self._display))
|
||||||
await wait_for_file_creation(x11_socket)
|
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
|
# sometimes the VNC process can crash
|
||||||
monitor_process(self._vnc_process, self._vnc_callback)
|
monitor_process(self._vnc_process, self._vnc_callback)
|
||||||
|
|
||||||
@ -825,6 +831,12 @@ class DockerVM(BaseNode):
|
|||||||
await self.stop()
|
await self.stop()
|
||||||
|
|
||||||
if self.console_type == "vnc":
|
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:
|
if self._vnc_process:
|
||||||
try:
|
try:
|
||||||
self._vnc_process.terminate()
|
self._vnc_process.terminate()
|
||||||
|
@ -40,7 +40,7 @@ class SnapshotHandler:
|
|||||||
input=SNAPSHOT_CREATE_SCHEMA,
|
input=SNAPSHOT_CREATE_SCHEMA,
|
||||||
output=SNAPSHOT_OBJECT_SCHEMA,
|
output=SNAPSHOT_OBJECT_SCHEMA,
|
||||||
status_codes={
|
status_codes={
|
||||||
201: "Snasphot created",
|
201: "Snapshot created",
|
||||||
404: "The project doesn't exist"
|
404: "The project doesn't exist"
|
||||||
})
|
})
|
||||||
async def create(request, response):
|
async def create(request, response):
|
||||||
@ -57,21 +57,21 @@ class SnapshotHandler:
|
|||||||
"project_id": "Project UUID",
|
"project_id": "Project UUID",
|
||||||
},
|
},
|
||||||
status_codes={
|
status_codes={
|
||||||
200: "Snasphot list returned",
|
200: "Snapshot list returned",
|
||||||
404: "The project doesn't exist"
|
404: "The project doesn't exist"
|
||||||
})
|
})
|
||||||
def list(request, response):
|
def list(request, response):
|
||||||
controller = Controller.instance()
|
controller = Controller.instance()
|
||||||
project = controller.get_project(request.match_info["project_id"])
|
project = controller.get_project(request.match_info["project_id"])
|
||||||
snapshots = [s for s in project.snapshots.values()]
|
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(
|
@Route.delete(
|
||||||
r"/projects/{project_id}/snapshots/{snapshot_id}",
|
r"/projects/{project_id}/snapshots/{snapshot_id}",
|
||||||
description="Delete a snapshot from disk",
|
description="Delete a snapshot from disk",
|
||||||
parameters={
|
parameters={
|
||||||
"project_id": "Project UUID",
|
"project_id": "Project UUID",
|
||||||
"snapshot_id": "Snasphot UUID"
|
"snapshot_id": "Snapshot UUID"
|
||||||
},
|
},
|
||||||
status_codes={
|
status_codes={
|
||||||
204: "Changes have been written on disk",
|
204: "Changes have been written on disk",
|
||||||
@ -89,7 +89,7 @@ class SnapshotHandler:
|
|||||||
description="Restore a snapshot from disk",
|
description="Restore a snapshot from disk",
|
||||||
parameters={
|
parameters={
|
||||||
"project_id": "Project UUID",
|
"project_id": "Project UUID",
|
||||||
"snapshot_id": "Snasphot UUID"
|
"snapshot_id": "Snapshot UUID"
|
||||||
},
|
},
|
||||||
output=PROJECT_OBJECT_SCHEMA,
|
output=PROJECT_OBJECT_SCHEMA,
|
||||||
status_codes={
|
status_codes={
|
||||||
|
Loading…
Reference in New Issue
Block a user