mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-12 19:38:57 +00:00
Fix auto idle-pc from preferences.
This commit is contained in:
parent
efbf7728ea
commit
e54d574e47
@ -622,13 +622,14 @@ class Controller:
|
||||
return Controller._instance
|
||||
|
||||
@asyncio.coroutine
|
||||
def autoidlepc(self, compute_id, platform, image):
|
||||
def autoidlepc(self, compute_id, platform, image, ram):
|
||||
"""
|
||||
Compute and IDLE PC value for an image
|
||||
|
||||
:param compute_id: ID of the compute where the idlepc operation need to run
|
||||
:param platform: Platform type
|
||||
:param image: Image to use
|
||||
:param ram: amount of RAM to use
|
||||
"""
|
||||
compute = self.get_compute(compute_id)
|
||||
for project in list(self._projects.values()):
|
||||
@ -636,7 +637,7 @@ class Controller:
|
||||
yield from project.delete()
|
||||
self.remove_project(project)
|
||||
project = yield from self.add_project(name="AUTOIDLEPC")
|
||||
node = yield from project.add_node(compute, "AUTOIDLEPC", str(uuid.uuid4()), node_type="dynamips", platform=platform, image=image, ram=512)
|
||||
node = yield from project.add_node(compute, "AUTOIDLEPC", str(uuid.uuid4()), node_type="dynamips", platform=platform, image=image, ram=ram)
|
||||
res = yield from node.dynamips_auto_idlepc()
|
||||
yield from project.delete()
|
||||
self.remove_project(project)
|
||||
|
@ -185,7 +185,7 @@ class ComputeHandler:
|
||||
response.set_status(204)
|
||||
|
||||
@Route.post(
|
||||
r"/computes/{compute_id}/autoidlepc",
|
||||
r"/computes/{compute_id}/auto_idlepc",
|
||||
parameters={
|
||||
"compute_id": "Compute UUID"
|
||||
},
|
||||
@ -195,6 +195,6 @@ class ComputeHandler:
|
||||
description="Compute IDLE PC value")
|
||||
def autoidlepc(request, response):
|
||||
controller = Controller.instance()
|
||||
res = yield from controller.autoidlepc(request.match_info["compute_id"], request.json["platform"], request.json["image"])
|
||||
response.set_status(200)
|
||||
res = yield from controller.autoidlepc(request.match_info["compute_id"], request.json["platform"], request.json["image"], request.json["ram"])
|
||||
response.json(res)
|
||||
response.set_status(200)
|
||||
|
Loading…
Reference in New Issue
Block a user