From fda33c56dec1a2dbcd319c33c0bae64ecd1074eb Mon Sep 17 00:00:00 2001 From: grossmj Date: Thu, 3 Sep 2015 16:18:27 -0600 Subject: [PATCH 1/4] Catch exception when a process cannot be killed. Fixes #296. --- gns3server/modules/dynamips/hypervisor.py | 7 ++++++- gns3server/modules/qemu/qemu_vm.py | 7 +++++-- gns3server/modules/vpcs/vpcs_vm.py | 5 +++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/gns3server/modules/dynamips/hypervisor.py b/gns3server/modules/dynamips/hypervisor.py index a568ff51..caac0148 100644 --- a/gns3server/modules/dynamips/hypervisor.py +++ b/gns3server/modules/dynamips/hypervisor.py @@ -140,7 +140,12 @@ class Hypervisor(DynamipsHypervisor): except asyncio.TimeoutError: if self._process.returncode is None: log.warn("Dynamips process {} is still running... killing it".format(self._process.pid)) - self._process.kill() + try: + self._process.kill() + except OSError as e: + log.error("Cannot stop the Dynamips process: {}".format(e)) + if self._process.returncode is None: + log.warn('Dynamips hypervisor with PID={} is still running'.format(self._process.pid)) if self._stdout_file and os.access(self._stdout_file, os.W_OK): try: diff --git a/gns3server/modules/qemu/qemu_vm.py b/gns3server/modules/qemu/qemu_vm.py index 795a3969..94d0d334 100644 --- a/gns3server/modules/qemu/qemu_vm.py +++ b/gns3server/modules/qemu/qemu_vm.py @@ -604,9 +604,12 @@ class QemuVM(BaseVM): self._process.terminate() self._process.wait() except subprocess.TimeoutExpired: - self._process.kill() + try: + self._process.kill() + except OSError as e: + log.error("Cannot stop the Qemu process: {}".format(e)) if self._process.returncode is None: - log.warn('QEMU VM "{}" PID={} is still running'.format(self._name, self._process.pid)) + log.warn('QEMU VM "{}" with PID={} is still running'.format(self._name, self._process.pid)) self._process = None self._started = False self._stop_cpulimit() diff --git a/gns3server/modules/vpcs/vpcs_vm.py b/gns3server/modules/vpcs/vpcs_vm.py index 78cc644d..f9b42bf7 100644 --- a/gns3server/modules/vpcs/vpcs_vm.py +++ b/gns3server/modules/vpcs/vpcs_vm.py @@ -253,11 +253,12 @@ class VPCSVM(BaseVM): yield from gns3server.utils.asyncio.wait_for_process_termination(self._process, timeout=3) except asyncio.TimeoutError: if self._process.returncode is None: - log.warn("VPCS process {} is still running... killing it".format(self._process.pid)) try: self._process.kill() except OSError as e: - raise VPCSError("Can not stop the VPCS process: {}".format(e)) + log.error("Cannot stop the VPCS process: {}".format(e)) + if self._process.returncode is None: + log.warn('VPCS VM "{}" with PID={} is still running'.format(self._name, self._process.pid)) self._process = None self._started = False From 2689b6b7bbeb2f84da287c15e8ab9b3d489e2912 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Fri, 4 Sep 2015 18:22:59 +0200 Subject: [PATCH 2/4] Prepare 1.3.10 --- CHANGELOG | 7 +++++++ gns3server/version.py | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 41fbcbba..1a06415e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,12 @@ # Change Log +## 1.3.10 04/09/2015 + +* Catch exception when a process cannot be killed. Fixes #296. +* Backport: fixes NAT NIO for Qemu VMs (do not launch any legacy scripts) +* Fixes Unicode error. Fixes #290. +* Don't delete Dynamips ROM files. They are used to restore the nvram. + ## 1.3.9 03/08/2015 * Backport: removes code that deletes IOS router instance files. diff --git a/gns3server/version.py b/gns3server/version.py index ff1480eb..1e77f1f4 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -23,5 +23,5 @@ # or negative for a release candidate or beta (after the base version # number has been incremented) -__version__ = "1.3.10dev1" -__version_info__ = (1, 3, 10, -99) +__version__ = "1.3.10" +__version_info__ = (1, 3, 10, 0) From 5fa5e7227d0ab533d59776a99a9323efcdc4d620 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Fri, 4 Sep 2015 21:33:48 +0200 Subject: [PATCH 3/4] Prepare next release --- gns3server/version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/version.py b/gns3server/version.py index 1e77f1f4..327af999 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -23,5 +23,5 @@ # or negative for a release candidate or beta (after the base version # number has been incremented) -__version__ = "1.3.10" -__version_info__ = (1, 3, 10, 0) +__version__ = "1.3.11dev1" +__version_info__ = (1, 3, 11, -99) From 2c5b2a19f64ddd6ecf6ece84811d040f54fcfde0 Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 8 Sep 2015 02:00:39 -0600 Subject: [PATCH 4/4] Check for valid FR or ATM switch mappings. Fixes #300. --- gns3server/modules/dynamips/nodes/atm_switch.py | 8 +++++++- gns3server/modules/dynamips/nodes/frame_relay_switch.py | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gns3server/modules/dynamips/nodes/atm_switch.py b/gns3server/modules/dynamips/nodes/atm_switch.py index 141293af..86dc2305 100644 --- a/gns3server/modules/dynamips/nodes/atm_switch.py +++ b/gns3server/modules/dynamips/nodes/atm_switch.py @@ -51,10 +51,14 @@ class ATMSwitch(Device): def __json__(self): + mappings = {} + for source, destination in self._mappings.items(): + mappings[str(source)] = str(destination) + return {"name": self.name, "device_id": self.id, "project_id": self.project.id, - "mappings": self._mappings} + "mappings": mappings} @asyncio.coroutine def create(self): @@ -199,6 +203,8 @@ class ATMSwitch(Device): pvc_entry = re.compile(r"""^([0-9]*):([0-9]*):([0-9]*)$""") for source, destination in mappings.items(): + if not isinstance(source, str) or not isinstance(destination, str): + raise DynamipsError("Invalid ATM mappings") match_source_pvc = pvc_entry.search(source) match_destination_pvc = pvc_entry.search(destination) if match_source_pvc and match_destination_pvc: diff --git a/gns3server/modules/dynamips/nodes/frame_relay_switch.py b/gns3server/modules/dynamips/nodes/frame_relay_switch.py index c1f06c84..9039dca6 100644 --- a/gns3server/modules/dynamips/nodes/frame_relay_switch.py +++ b/gns3server/modules/dynamips/nodes/frame_relay_switch.py @@ -50,10 +50,14 @@ class FrameRelaySwitch(Device): def __json__(self): + mappings = {} + for source, destination in self._mappings.items(): + mappings[str(source)] = str(destination) + return {"name": self.name, "device_id": self.id, "project_id": self.project.id, - "mappings": self._mappings} + "mappings": mappings} @asyncio.coroutine def create(self): @@ -191,6 +195,8 @@ class FrameRelaySwitch(Device): """ for source, destination in mappings.items(): + if not isinstance(source, str) or not isinstance(destination, str): + raise DynamipsError("Invalid Frame-Relay mappings") source_port, source_dlci = map(int, source.split(':')) destination_port, destination_dlci = map(int, destination.split(':')) if self.has_port(destination_port):