From 565a7b35a6f8b0862698acd75a5627e6dd6fa5d9 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 21 Feb 2015 17:24:39 -0700 Subject: [PATCH] Default NVRAM and Idle-PC for some IOS images. --- gns3server/handlers/dynamips_vm_handler.py | 1 + gns3server/modules/dynamips/__init__.py | 3 +-- gns3server/modules/dynamips/nodes/c1700.py | 4 ++-- gns3server/modules/dynamips/nodes/c2600.py | 4 ++-- gns3server/modules/dynamips/nodes/c2691.py | 4 ++-- gns3server/modules/dynamips/nodes/c3600.py | 4 ++-- gns3server/modules/dynamips/nodes/c3725.py | 2 +- gns3server/modules/dynamips/nodes/c3745.py | 4 ++-- gns3server/modules/dynamips/nodes/c7200.py | 4 ++-- gns3server/modules/dynamips/nodes/router.py | 5 +++-- 10 files changed, 18 insertions(+), 17 deletions(-) diff --git a/gns3server/handlers/dynamips_vm_handler.py b/gns3server/handlers/dynamips_vm_handler.py index 74387e74..aa674e4c 100644 --- a/gns3server/handlers/dynamips_vm_handler.py +++ b/gns3server/handlers/dynamips_vm_handler.py @@ -106,6 +106,7 @@ class DynamipsVMHandler: vm = dynamips_manager.get_vm(request.match_info["vm_id"], project_id=request.match_info["project_id"]) yield from dynamips_manager.update_vm_settings(vm, request.json) + yield from dynamips_manager.ghost_ios_support(vm) response.json(vm) @classmethod diff --git a/gns3server/modules/dynamips/__init__.py b/gns3server/modules/dynamips/__init__.py index e6df32dd..5c388f14 100644 --- a/gns3server/modules/dynamips/__init__.py +++ b/gns3server/modules/dynamips/__init__.py @@ -410,7 +410,7 @@ class Dynamips(BaseManager): 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") + log.warning("Ghost IOS is not supported for c7200 with NPE-G2") return ghost_file = vm.formatted_ghost_file() @@ -530,7 +530,6 @@ class Dynamips(BaseManager): try: with open(path, "w") as f: - log.info("Creating config file {}".format(path)) f.write(content) except OSError as e: raise DynamipsError("Could not create config file {}: {}".format(path, e)) diff --git a/gns3server/modules/dynamips/nodes/c1700.py b/gns3server/modules/dynamips/nodes/c1700.py index 9ff6e51b..707c2baf 100644 --- a/gns3server/modules/dynamips/nodes/c1700.py +++ b/gns3server/modules/dynamips/nodes/c1700.py @@ -47,8 +47,8 @@ class C1700(Router): def __init__(self, name, vm_id, project, manager, dynamips_id, chassis="1720"): Router.__init__(self, name, vm_id, project, manager, dynamips_id, platform="c1700") - # Set default values for this platform - self._ram = 128 + # Set default values for this platform (must be the same as Dynamips) + self._ram = 64 self._nvram = 32 self._disk0 = 0 self._disk1 = 0 diff --git a/gns3server/modules/dynamips/nodes/c2600.py b/gns3server/modules/dynamips/nodes/c2600.py index 497a5d56..9a63c487 100644 --- a/gns3server/modules/dynamips/nodes/c2600.py +++ b/gns3server/modules/dynamips/nodes/c2600.py @@ -62,8 +62,8 @@ class C2600(Router): def __init__(self, name, vm_id, project, manager, dynamips_id, chassis="2610"): Router.__init__(self, name, vm_id, project, manager, dynamips_id, platform="c2600") - # Set default values for this platform - self._ram = 128 + # Set default values for this platform (must be the same as Dynamips) + self._ram = 64 self._nvram = 128 self._disk0 = 0 self._disk1 = 0 diff --git a/gns3server/modules/dynamips/nodes/c2691.py b/gns3server/modules/dynamips/nodes/c2691.py index d40efd2c..3b5b7332 100644 --- a/gns3server/modules/dynamips/nodes/c2691.py +++ b/gns3server/modules/dynamips/nodes/c2691.py @@ -43,8 +43,8 @@ class C2691(Router): def __init__(self, name, vm_id, project, manager, dynamips_id): Router.__init__(self, name, vm_id, project, manager, dynamips_id, platform="c2691") - # Set default values for this platform - self._ram = 192 + # Set default values for this platform (must be the same as Dynamips) + self._ram = 128 self._nvram = 112 self._disk0 = 16 self._disk1 = 0 diff --git a/gns3server/modules/dynamips/nodes/c3600.py b/gns3server/modules/dynamips/nodes/c3600.py index 415d9a74..aa0d2249 100644 --- a/gns3server/modules/dynamips/nodes/c3600.py +++ b/gns3server/modules/dynamips/nodes/c3600.py @@ -45,8 +45,8 @@ class C3600(Router): def __init__(self, name, vm_id, project, manager, dynamips_id, chassis="3640"): Router.__init__(self, name, vm_id, project, manager, dynamips_id, platform="c3600") - # Set default values for this platform - self._ram = 192 + # Set default values for this platform (must be the same as Dynamips) + self._ram = 128 self._nvram = 128 self._disk0 = 0 self._disk1 = 0 diff --git a/gns3server/modules/dynamips/nodes/c3725.py b/gns3server/modules/dynamips/nodes/c3725.py index 0d0ce36d..6a1481a1 100644 --- a/gns3server/modules/dynamips/nodes/c3725.py +++ b/gns3server/modules/dynamips/nodes/c3725.py @@ -43,7 +43,7 @@ class C3725(Router): def __init__(self, name, vm_id, project, manager, dynamips_id): Router.__init__(self, name, vm_id, project, manager, dynamips_id, platform="c3725") - # Set default values for this platform + # Set default values for this platform (must be the same as Dynamips) self._ram = 128 self._nvram = 112 self._disk0 = 16 diff --git a/gns3server/modules/dynamips/nodes/c3745.py b/gns3server/modules/dynamips/nodes/c3745.py index d94b9883..e9bd84e1 100644 --- a/gns3server/modules/dynamips/nodes/c3745.py +++ b/gns3server/modules/dynamips/nodes/c3745.py @@ -43,8 +43,8 @@ class C3745(Router): def __init__(self, name, vm_id, project, manager, dynamips_id): Router.__init__(self, name, vm_id, project, manager, dynamips_id, platform="c3745") - # Set default values for this platform - self._ram = 256 + # Set default values for this platform (must be the same as Dynamips) + self._ram = 128 self._nvram = 304 self._disk0 = 16 self._disk1 = 0 diff --git a/gns3server/modules/dynamips/nodes/c7200.py b/gns3server/modules/dynamips/nodes/c7200.py index ca70ecb7..218d35ab 100644 --- a/gns3server/modules/dynamips/nodes/c7200.py +++ b/gns3server/modules/dynamips/nodes/c7200.py @@ -47,8 +47,8 @@ class C7200(Router): def __init__(self, name, vm_id, project, manager, dynamips_id, npe="npe-400"): Router.__init__(self, name, vm_id, project, manager, dynamips_id, platform="c7200") - # Set default values for this platform - self._ram = 512 + # Set default values for this platform (must be the same as Dynamips) + self._ram = 256 self._nvram = 128 self._disk0 = 64 self._disk1 = 0 diff --git a/gns3server/modules/dynamips/nodes/router.py b/gns3server/modules/dynamips/nodes/router.py index 92f14c02..a94f4af5 100644 --- a/gns3server/modules/dynamips/nodes/router.py +++ b/gns3server/modules/dynamips/nodes/router.py @@ -308,7 +308,8 @@ class Router(BaseVM): 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 in self._hypervisor.devices: + self._hypervisor.devices.remove(self) if self._hypervisor and not self._hypervisor.devices: try: yield from self.stop() @@ -1478,7 +1479,7 @@ class Router(BaseVM): """ try: - reply = yield from self._hypervisor.send("vm extract_config {}".format(self._name)) + reply = yield from self._hypervisor.send('vm extract_config "{}"'.format(self._name)) except DynamipsError: # for some reason Dynamips gets frozen when it does not find the magic number in the NVRAM file. return None, None