mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-26 00:38:10 +00:00
Idle-PC proposals for Dynamips.
This commit is contained in:
parent
b393948b67
commit
90f71e7581
@ -349,3 +349,24 @@ class DynamipsVMHandler:
|
||||
response.set_status(200)
|
||||
response.json({"startup_config_content": startup_config_content,
|
||||
"private_config_content": private_config_content})
|
||||
|
||||
@Route.get(
|
||||
r"/projects/{project_id}/dynamips/vms/{vm_id}/idlepc_proposals",
|
||||
status_codes={
|
||||
200: "Idle-PCs retrieved",
|
||||
400: "Invalid request",
|
||||
404: "Instance doesn't exist"
|
||||
},
|
||||
description="Retrieve the idlepc proposals")
|
||||
def get_idlepcs(request, response):
|
||||
|
||||
dynamips_manager = Dynamips.instance()
|
||||
vm = dynamips_manager.get_vm(request.match_info["vm_id"],
|
||||
project_id=request.match_info["project_id"])
|
||||
|
||||
yield from vm.set_idlepc("0x0")
|
||||
idlepcs = yield from vm.get_idle_pc_prop()
|
||||
|
||||
#idlepcs = yield from vm.show_idle_pc_prop()
|
||||
response.set_status(200)
|
||||
response.json({"idlepcs": idlepcs})
|
||||
|
@ -409,6 +409,10 @@ class Dynamips(BaseManager):
|
||||
if not vm.mmap:
|
||||
raise DynamipsError("mmap support is required to enable ghost IOS support")
|
||||
|
||||
if vm.platform == "c7200" and vm.npe == "npe-g2":
|
||||
log.warning("Ghost IOS is not support for c7200 with NPE-G2")
|
||||
return
|
||||
|
||||
ghost_file = vm.formatted_ghost_file()
|
||||
ghost_file_path = os.path.join(vm.hypervisor.working_dir, ghost_file)
|
||||
if ghost_file_path not in self._ghost_files:
|
||||
@ -418,9 +422,6 @@ class Dynamips(BaseManager):
|
||||
try:
|
||||
yield from ghost.create()
|
||||
yield from ghost.set_image(vm.image)
|
||||
# for 7200s, the NPE must be set when using an NPE-G2.
|
||||
if vm.platform == "c7200":
|
||||
yield from ghost.set_npe(vm.npe)
|
||||
yield from ghost.set_ghost_status(1)
|
||||
yield from ghost.set_ghost_file(ghost_file)
|
||||
yield from ghost.set_ram(vm.ram)
|
||||
@ -463,6 +464,7 @@ class Dynamips(BaseManager):
|
||||
adapter = ADAPTER_MATRIX[adapter_name]()
|
||||
if vm.slots[slot_id] and type(vm.slots[slot_id]) != type(adapter):
|
||||
yield from vm.slot_remove_binding(slot_id)
|
||||
if type(vm.slots[slot_id]) != type(adapter):
|
||||
yield from vm.slot_add_binding(slot_id, adapter)
|
||||
elif name.startswith("slot") and value is None:
|
||||
slot_id = int(name[-1])
|
||||
@ -474,6 +476,7 @@ class Dynamips(BaseManager):
|
||||
wic = WIC_MATRIX[wic_name]()
|
||||
if vm.slots[0].wics[wic_slot_id] and type(vm.slots[0].wics[wic_slot_id]) != type(wic):
|
||||
yield from vm.uninstall_wic(wic_slot_id)
|
||||
if type(vm.slots[0].wics[wic_slot_id]) != type(wic):
|
||||
yield from vm.install_wic(wic_slot_id, wic)
|
||||
elif name.startswith("wic") and value is None:
|
||||
wic_slot_id = int(name[-1])
|
||||
|
@ -305,6 +305,9 @@ class Router(BaseVM):
|
||||
# router is already closed
|
||||
return
|
||||
|
||||
if self._dynamips_id in self._dynamips_ids[self._project.id]:
|
||||
self._dynamips_ids[self._project.id].remove(self._dynamips_id)
|
||||
|
||||
self._hypervisor.devices.remove(self)
|
||||
if self._hypervisor and not self._hypervisor.devices:
|
||||
try:
|
||||
@ -323,9 +326,6 @@ class Router(BaseVM):
|
||||
self._manager.port_manager.release_console_port(self._aux)
|
||||
self._aux = None
|
||||
|
||||
if self._dynamips_id in self._dynamips_ids[self._project.id]:
|
||||
self._dynamips_ids[self._project.id].remove(self._dynamips_id)
|
||||
|
||||
self._closed = True
|
||||
|
||||
@property
|
||||
|
Loading…
Reference in New Issue
Block a user