Save IOS router configs when saving the project (done right this time).

This commit is contained in:
Jeremy committed 2015-03-18 15:34:31 -06:00
1 parent f6b122cdfa
commit 8415117d2d
4 files changed
+24 -37

No files matched your search

-10
View File
@@ -282,16 +282,6 @@ class BaseManager:
pass
@asyncio.coroutine
def project_committed(self, project):
"""
Called when a project is committed.
:param project: Project instance
"""
pass
@asyncio.coroutine
def delete_vm(self, vm_id):
"""
+6 -22
View File
@@ -115,7 +115,6 @@ class Dynamips(BaseManager):
self._devices = {}
self._ghost_files = set()
self._dynamips_path = None
self._project_lock = asyncio.Lock()
@asyncio.coroutine
def unload(self):
@@ -192,28 +191,13 @@ class Dynamips(BaseManager):
:param project: Project instance
"""
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 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()))
@asyncio.coroutine
def project_committed(self, project):
"""
Called when a project has been committed.
:param project: Project instance
"""
# save the configs when the project is committed
with (yield from self._project_lock):
for vm in self._vms.values():
if vm.project.id == project.id:
yield from vm.save_configs()
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()))
@property
def dynamips_path(self):
-2
View File
@@ -324,8 +324,6 @@ class Project:
vm = self._vms_to_destroy.pop()
yield from vm.delete()
self.remove_vm(vm)
for module in self.modules():
yield from module.instance().project_committed(self)
@asyncio.coroutine
def delete(self):