diff --git a/gns3server/modules/base_manager.py b/gns3server/modules/base_manager.py index 056ad8fc..ad12a784 100644 --- a/gns3server/modules/base_manager.py +++ b/gns3server/modules/base_manager.py @@ -237,7 +237,7 @@ class BaseManager: @asyncio.coroutine def close_vm(self, vm_id): """ - Delete a VM + Close a VM :param vm_id: VM identifier @@ -305,7 +305,8 @@ class BaseManager: vm = yield from self.close_vm(vm_id) vm.project.mark_vm_for_destruction(vm) - del self._vms[vm.id] + if vm.id in self._vms: + del self._vms[vm.id] return vm @staticmethod diff --git a/gns3server/modules/dynamips/__init__.py b/gns3server/modules/dynamips/__init__.py index bc888b23..d2cc958e 100644 --- a/gns3server/modules/dynamips/__init__.py +++ b/gns3server/modules/dynamips/__init__.py @@ -357,7 +357,10 @@ class Dynamips(BaseManager): 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) + try: + yield from self._set_ghost_ios(vm) + except GeneratorExit: + log.warning("Could not create ghost IOS image {} (GeneratorExit)".format(vm.name)) @asyncio.coroutine def create_nio(self, node, nio_settings): diff --git a/gns3server/modules/virtualbox/virtualbox_vm.py b/gns3server/modules/virtualbox/virtualbox_vm.py index 08a567fd..350bd92e 100644 --- a/gns3server/modules/virtualbox/virtualbox_vm.py +++ b/gns3server/modules/virtualbox/virtualbox_vm.py @@ -279,7 +279,7 @@ class VirtualBoxVM(BaseVM): try: with open(hdd_info_file, "r", encoding="utf-8") as f: hdd_table = json.load(f) - except OSError as e: + except (ValueError, OSError) as e: raise VirtualBoxError("Could not read HDD info file: {}".format(e)) for hdd_info in hdd_table: