Checks if IOS image exist at startup and not during node creation. Fixes #240.

This commit is contained in:
Jeremy 2015-06-29 16:30:57 -06:00
parent 3b3929803b
commit be85d95ff7
3 changed files with 9 additions and 13 deletions

View File

@ -74,7 +74,6 @@ class DynamipsVMHandler:
chassis=request.json.pop("chassis", default_chassis))
yield from dynamips_manager.update_vm_settings(vm, request.json)
yield from dynamips_manager.ghost_ios_support(vm)
response.set_status(201)
response.json(vm)
@ -120,7 +119,6 @@ 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
@ -161,6 +159,7 @@ class DynamipsVMHandler:
dynamips_manager = Dynamips.instance()
vm = dynamips_manager.get_vm(request.match_info["vm_id"], project_id=request.match_info["project_id"])
yield from dynamips_manager.ghost_ios_support(vm)
yield from vm.start()
response.set_status(204)

View File

@ -360,14 +360,6 @@ class Dynamips(BaseManager):
return hypervisor
@asyncio.coroutine
def ghost_ios_support(self, vm):
ghost_ios_support = self.config.get_section_config("Dynamips").getboolean("ghost_ios_support", True)
if ghost_ios_support:
with (yield from Dynamips._ghost_ios_lock):
yield from self._set_ghost_ios(vm)
@asyncio.coroutine
def create_nio(self, node, nio_settings):
"""
@ -437,6 +429,14 @@ class Dynamips(BaseManager):
yield from nio.create()
return nio
@asyncio.coroutine
def ghost_ios_support(self, vm):
ghost_ios_support = self.config.get_section_config("Dynamips").getboolean("ghost_ios_support", True)
if ghost_ios_support:
with (yield from Dynamips._ghost_ios_lock):
yield from self._set_ghost_ios(vm)
@asyncio.coroutine
def _set_ghost_ios(self, vm):
"""

View File

@ -462,9 +462,6 @@ class Router(BaseVM):
image = self.manager.get_abs_image_path(image)
if not os.path.isfile(image):
raise DynamipsError("IOS image '{}' is not accessible".format(image))
yield from self._hypervisor.send('vm set_ios "{name}" "{image}"'.format(name=self._name, image=image))
log.info('Router "{name}" [{id}]: has a new IOS image set: "{image}"'.format(name=self._name,