diff --git a/gns3server/modules/attic.py b/gns3server/modules/attic.py index cdfcc050..9a31653e 100644 --- a/gns3server/modules/attic.py +++ b/gns3server/modules/attic.py @@ -58,9 +58,11 @@ def find_unused_port(start_port, end_port, host='127.0.0.1', socket_type="TCP", if ":" in host: # IPv6 address support with socket.socket(socket.AF_INET6, socket_type) as s: + s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind((host, port)) # the port is available if bind is a success else: with socket.socket(socket.AF_INET, socket_type) as s: + s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind((host, port)) # the port is available if bind is a success return port except OSError as e: diff --git a/gns3server/modules/qemu/__init__.py b/gns3server/modules/qemu/__init__.py index c4b2dfbc..bb740510 100644 --- a/gns3server/modules/qemu/__init__.py +++ b/gns3server/modules/qemu/__init__.py @@ -630,8 +630,7 @@ class Qemu(IModule): paths.append(os.path.join(os.environ["PROGRAMFILES"], "qemu")) elif sys.platform.startswith("darwin"): # add specific locations on Mac OS X regardless of what's in $PATH - paths.append("/usr/local/bin") - paths.append("/opt/local/bin") + paths.extend(["/usr/local/bin", "/opt/local/bin"]) for path in paths: try: for f in os.listdir(path): @@ -639,7 +638,8 @@ class Qemu(IModule): qemu_path = os.path.join(path, f) version = self._get_qemu_version(qemu_path) qemus.append({"path": qemu_path, "version": version}) - except OSError: + except (OSError, QemuError) as e: + log.warn("Could not find QEMU version for {}: {}".format(path, e)) continue response = {"server": self._host,