diff --git a/gns3server/modules/dynamips/__init__.py b/gns3server/modules/dynamips/__init__.py index ed538f23..16bc67c6 100644 --- a/gns3server/modules/dynamips/__init__.py +++ b/gns3server/modules/dynamips/__init__.py @@ -494,12 +494,12 @@ class Dynamips(BaseManager): yield from vm.set_sparsemem(False) # update the configs if needed - yield from self.create_vm_configs(vm, settings) + yield from self.set_vm_configs(vm, settings) @asyncio.coroutine - def create_vm_configs(self, vm, settings): + def set_vm_configs(self, vm, settings): """ - Creates VM configs from pushed content. + Set VM configs from pushed content or existing config files. :param vm: VM instance :param settings: VM settings @@ -514,16 +514,18 @@ class Dynamips(BaseManager): startup_config_path = self._create_config(vm, startup_config_content, default_startup_config_path) yield from vm.set_configs(startup_config_path) else: - startup_config_path = settings.get("startup_config", "") - yield from vm.set_configs(startup_config_path) + startup_config_path = settings.get("startup_config") + if startup_config_path: + yield from vm.set_configs(startup_config_path) private_config_content = settings.get("private_config_content") if private_config_content: private_config_path = self._create_config(vm, private_config_content, default_private_config_path) yield from vm.set_configs(vm.startup_config, private_config_path) else: - private_config_path = settings.get("private_config", "") - yield from vm.set_configs(vm.startup_config, private_config_path) + private_config_path = settings.get("private_config") + if private_config_path: + yield from vm.set_configs(vm.startup_config, private_config_path) def _create_config(self, vm, content, path): """ diff --git a/gns3server/modules/dynamips/hypervisor.py b/gns3server/modules/dynamips/hypervisor.py index 5a620357..ce1b4ade 100644 --- a/gns3server/modules/dynamips/hypervisor.py +++ b/gns3server/modules/dynamips/hypervisor.py @@ -138,9 +138,9 @@ class Hypervisor(DynamipsHypervisor): try: yield from asyncio.wait_for(self._process.wait(), timeout=3) except asyncio.TimeoutError: - self._process.kill() if self._process.returncode is None: - log.warn("Dynamips process {} is still running".format(self._process.pid)) + log.warn("Dynamips process {} is still running... killing it".format(self._process.pid)) + self._process.kill() if self._stdout_file and os.access(self._stdout_file, os.W_OK): try: diff --git a/gns3server/modules/dynamips/nodes/router.py b/gns3server/modules/dynamips/nodes/router.py index 98d9384f..03a8f60c 100644 --- a/gns3server/modules/dynamips/nodes/router.py +++ b/gns3server/modules/dynamips/nodes/router.py @@ -1249,6 +1249,8 @@ class Router(BaseVM): port_number=port_number)) nio = adapter.get_nio(port_number) + if nio is None: + return if isinstance(nio, NIOUDP): self.manager.port_manager.release_udp_port(nio.lport) adapter.remove_nio(port_number) diff --git a/gns3server/modules/iou/iou_vm.py b/gns3server/modules/iou/iou_vm.py index 059db000..299a9258 100644 --- a/gns3server/modules/iou/iou_vm.py +++ b/gns3server/modules/iou/iou_vm.py @@ -488,9 +488,10 @@ class IOUVM(BaseVM): try: yield from gns3server.utils.asyncio.wait_for_process_termination(self._iou_process, timeout=3) except asyncio.TimeoutError: - self._iou_process.kill() if self._iou_process.returncode is None: - log.warn("IOU process {} is still running".format(self._iou_process.pid)) + log.warn("IOU process {} is still running... killing it".format(self._iou_process.pid)) + self._iou_process.kill() + self._iou_process = None if self._iouyap_process is not None: @@ -498,11 +499,11 @@ class IOUVM(BaseVM): try: yield from gns3server.utils.asyncio.wait_for_process_termination(self._iouyap_process, timeout=3) except asyncio.TimeoutError: - self._iouyap_process.kill() if self._iouyap_process.returncode is None: - log.warn("IOUYAP process {} is still running".format(self._iouyap_process.pid)) - self._iouyap_process = None + log.warn("IOUYAP process {} is still running... killing it".format(self._iouyap_process.pid)) + self._iouyap_process.kill() + self._iouyap_process = None self._started = False def _terminate_process_iouyap(self): diff --git a/gns3server/modules/vpcs/vpcs_vm.py b/gns3server/modules/vpcs/vpcs_vm.py index 56c89bd1..dad5e87c 100644 --- a/gns3server/modules/vpcs/vpcs_vm.py +++ b/gns3server/modules/vpcs/vpcs_vm.py @@ -245,9 +245,9 @@ class VPCSVM(BaseVM): try: yield from asyncio.wait_for(self._process.wait(), timeout=3) except asyncio.TimeoutError: - self._process.kill() if self._process.returncode is None: - log.warn("VPCS process {} is still running".format(self._process.pid)) + log.warn("VPCS process {} is still running... killing it".format(self._process.pid)) + self._process.kill() self._process = None self._started = False