1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Fix Dynamips private config not loaded into nvram when starting a router. Fixes #1313.

This commit is contained in:
grossmj 2018-03-07 18:18:51 +07:00
parent d911e82dc4
commit 3ca4f72b99

View File

@ -283,12 +283,15 @@ class Router(BaseNode):
if not self._ghost_flag: if not self._ghost_flag:
self.check_available_ram(self.ram) self.check_available_ram(self.ram)
# config paths are relative to the working directory configured on Dynamips hypervisor
startup_config_path = os.path.join("configs", "i{}_startup-config.cfg".format(self._dynamips_id)) startup_config_path = os.path.join("configs", "i{}_startup-config.cfg".format(self._dynamips_id))
private_config_path = os.path.join("configs", "i{}_private-config.cfg".format(self._dynamips_id)) private_config_path = os.path.join("configs", "i{}_private-config.cfg".format(self._dynamips_id))
if not os.path.exists(private_config_path) or not os.path.getsize(private_config_path): if not os.path.exists(os.path.join(self._working_directory, private_config_path)) or \
not os.path.getsize(os.path.join(self._working_directory, private_config_path)):
# an empty private-config can prevent a router to boot. # an empty private-config can prevent a router to boot.
private_config_path = '' private_config_path = ''
yield from self._hypervisor.send('vm set_config "{name}" "{startup}" "{private}"'.format( yield from self._hypervisor.send('vm set_config "{name}" "{startup}" "{private}"'.format(
name=self._name, name=self._name,
startup=startup_config_path, startup=startup_config_path,