1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-15 12:59:06 +00:00

Save IOS configs when a project is committed.

This commit is contained in:
Jeremy 2015-03-17 18:53:24 -06:00
parent 386b311755
commit 163d1e375d

View File

@ -115,6 +115,7 @@ class Dynamips(BaseManager):
self._devices = {}
self._ghost_files = set()
self._dynamips_path = None
self._project_lock = asyncio.Lock()
@asyncio.coroutine
def unload(self):
@ -191,13 +192,14 @@ class Dynamips(BaseManager):
:param project: Project instance
"""
for vm in self._vms.values():
if vm.project.id == project.id:
yield from vm.hypervisor.set_working_dir(project.module_working_directory(self.module_name.lower()))
with (yield from self._project_lock):
for vm in self._vms.values():
if vm.project.id == project.id:
yield from vm.hypervisor.set_working_dir(project.module_working_directory(self.module_name.lower()))
for device in self._devices.values():
if device.project.id == project.id:
yield from device.hypervisor.set_working_dir(project.module_working_directory(self.module_name.lower()))
for device in self._devices.values():
if device.project.id == project.id:
yield from device.hypervisor.set_working_dir(project.module_working_directory(self.module_name.lower()))
@asyncio.coroutine
def project_committed(self, project):
@ -207,11 +209,11 @@ class Dynamips(BaseManager):
:param project: Project instance
"""
pass
# save the configs when the project is committed
#for vm in self._vms.values():
# if vm.project.id == project.id:
# yield from vm.save_configs()
with (yield from self._project_lock):
for vm in self._vms.values():
if vm.project.id == project.id:
yield from vm.save_configs()
@property
def dynamips_path(self):