Skip to content

Commit

Permalink
Improve dynamips startup_config dump
Browse files Browse the repository at this point in the history
Two change:
1) Dump the config when you stop the node. This avoid scenar
2) Disallow empty startup config. If it's empty send ! it's
avoid dynamips crash

Fix #914
  • Loading branch information
julien-duponchelle committed Jan 15, 2016
1 parent f83e878 commit 2938b97
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions gns3server/modules/dynamips/__init__.py
Expand Up @@ -602,6 +602,10 @@ def set_vm_configs(self, vm, settings):
elif startup_config_content:
startup_config_path = self._create_config(vm, default_startup_config_path, startup_config_content)
yield from vm.set_configs(startup_config_path)
# An empty startup config crash dynamips
else:
startup_config_path = self._create_config(vm, default_startup_config_path, "!\n")
yield from vm.set_configs(startup_config_path)

private_config_path = settings.get("private_config")
private_config_content = settings.get("private_config_content")
Expand Down
2 changes: 1 addition & 1 deletion gns3server/modules/dynamips/nodes/router.py
Expand Up @@ -281,6 +281,7 @@ def stop(self):
yield from self._hypervisor.send('vm stop "{name}"'.format(name=self._name))
self.status = "stopped"
log.info('Router "{name}" [{id}] has been stopped'.format(name=self._name, id=self._id))
yield from self.save_configs()

@asyncio.coroutine
def reload(self):
Expand Down Expand Up @@ -352,7 +353,6 @@ def close(self):
if self._hypervisor and not self._hypervisor.devices:
try:
yield from self.stop()
yield from self.save_configs()
yield from self._hypervisor.send('vm delete "{}"'.format(self._name))
except DynamipsError:
pass
Expand Down

0 comments on commit 2938b97

Please sign in to comment.