Suspend for Docker nodes.

pull/1302/head
grossmj 6 years ago
parent 7ded71142f
commit bd8816d14c

@ -188,7 +188,7 @@ class ATMSwitchHandler:
400: "Invalid request",
404: "Instance doesn't exist"
},
description="Suspend an ATM Relay switch")
description="Suspend an ATM Relay switch (does nothing)")
def suspend(request, response):
Dynamips.instance().get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])

@ -168,7 +168,7 @@ class CloudHandler:
400: "Invalid request",
404: "Instance doesn't exist"
},
description="Suspend a cloud")
description="Suspend a cloud (does nothing)")
def suspend(request, response):
Builtin.instance().get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])

@ -105,6 +105,24 @@ class DockerHandler:
yield from container.stop()
response.set_status(204)
@Route.post(
r"/projects/{project_id}/docker/nodes/{node_id}/suspend",
parameters={
"project_id": "Project UUID",
"node_id": "Node UUID"
},
status_codes={
204: "Instance suspended",
400: "Invalid request",
404: "Instance doesn't exist"
},
description="Suspend a Docker container")
def suspend(request, response):
docker_manager = Docker.instance()
container = docker_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
yield from container.pause()
response.set_status(204)
@Route.post(
r"/projects/{project_id}/docker/nodes/{node_id}/reload",
parameters={

@ -191,7 +191,7 @@ class EthernetHubHandler:
400: "Invalid request",
404: "Instance doesn't exist"
},
description="Suspend an Ethernet hub")
description="Suspend an Ethernet hub (does nothing)")
def suspend(request, response):
Dynamips.instance().get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])

@ -204,7 +204,7 @@ class EthernetSwitchHandler:
400: "Invalid request",
404: "Instance doesn't exist"
},
description="Suspend an Ethernet switch")
description="Suspend an Ethernet switch (does nothing)")
def suspend(request, response):
Dynamips.instance().get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])

@ -188,7 +188,7 @@ class FrameRelaySwitchHandler:
400: "Invalid request",
404: "Instance doesn't exist"
},
description="Suspend a Frame Relay switch")
description="Suspend a Frame Relay switch (does nothing)")
def suspend(request, response):
Dynamips.instance().get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])

@ -207,6 +207,24 @@ class IOUHandler:
yield from vm.stop()
response.set_status(204)
@Route.post(
r"/projects/{project_id}/iou/nodes/{node_id}/suspend",
parameters={
"project_id": "Project UUID",
"node_id": "Node UUID"
},
status_codes={
204: "Instance suspended",
400: "Invalid request",
404: "Instance doesn't exist"
},
description="Suspend an IOU instance (does nothing)")
def suspend(request, response):
iou_manager = IOU.instance()
iou_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
response.set_status(204)
@Route.post(
r"/projects/{project_id}/iou/nodes/{node_id}/reload",
parameters={

@ -166,7 +166,7 @@ class NatHandler:
400: "Invalid request",
404: "Instance doesn't exist"
},
description="Suspend a nat")
description="Suspend a nat (does nothing)")
def suspend(request, response):
Builtin.instance().get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])

@ -184,16 +184,15 @@ class VPCSHandler:
"node_id": "Node UUID"
},
status_codes={
204: "Instance stopped",
204: "Instance suspended",
400: "Invalid request",
404: "Instance doesn't exist"
},
description="Suspend a VPCS instance (stop it)")
def stop(request, response):
description="Suspend a VPCS instance (does nothing)")
def suspend(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()
vpcs_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
response.set_status(204)
@Route.post(

@ -25,7 +25,7 @@ function help {
echo "Usage:" >&2
echo "--with-openvpn: Install Open VPN" >&2
echo "--with-iou: Install IOU" >&2
echo "--with-i386-repository: Add i386 repositories require by IOU if they are not available on the system. Warning this will replace your source.list in order to use official ubuntu mirror" >&2
echo "--with-i386-repository: Add the i386 repositories required by IOU if they are not already available on the system. Warning: this will replace your source.list in order to use the official Ubuntu mirror" >&2
echo "--unstable: Use the GNS3 unstable repository"
echo "--help: This help" >&2
}
@ -37,7 +37,7 @@ function log {
lsb_release -d | grep "LTS" > /dev/null
if [ $? != 0 ]
then
echo "You can use this script on Ubuntu LTS only"
echo "This script can only be run on a Linux Ubuntu LTS release"
exit 1
fi

Loading…
Cancel
Save