1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-29 02:08:10 +00:00

Suspend for VPCS == stop

Fix #1465
This commit is contained in:
Julien Duponchelle 2016-09-05 16:55:38 +02:00
parent 1d70a18b11
commit 6e7f6a94ec
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
2 changed files with 20 additions and 1 deletions

View File

@ -452,7 +452,7 @@ class Compute:
elif response.status == 403:
raise aiohttp.web.HTTPForbidden(text=msg)
elif response.status == 404:
raise aiohttp.web.HTTPNotFound(text=msg)
raise aiohttp.web.HTTPNotFound(text="{} {} not found".format(method, path))
elif response.status == 409:
try:
raise ComputeConflict(json.loads(body))

View File

@ -159,6 +159,25 @@ class VPCSHandler:
yield from vm.stop()
response.set_status(204)
@Route.post(
r"/projects/{project_id}/vpcs/nodes/{node_id}/suspend",
parameters={
"project_id": "Project UUID",
"node_id": "Node UUID"
},
status_codes={
204: "Instance stopped",
400: "Invalid request",
404: "Instance doesn't exist"
},
description="Suspend a VPCS instance (stop it)")
def stop(request, response):
vpcs_manager = VPCS.instance()
vm = vpcs_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
yield from vm.stop()
response.set_status(204)
@Route.post(
r"/projects/{project_id}/vpcs/nodes/{node_id}/reload",
parameters={