From e1aa13fa73e8c394e354d959130b3e976217dcd7 Mon Sep 17 00:00:00 2001 From: Jeremy Grossmann Date: Tue, 26 Feb 2019 15:28:11 +0700 Subject: [PATCH 01/13] Force jsonschema dependency to 2.6.0 This is to fix this issue when starting the (frozen) application on Windows: ``` File "C:\Python36-x64\lib\site-packages\jsonschema\validators.py", line 505, in File "C:\Python36-x64\lib\site-packages\jsonschema\_utils.py", line 57, in load_schema File "C:\Python36-x64\lib\pkgutil.py", line 634, in get_data OSError: [Errno 34] Result too large: 'jsonschema\\schemas\\draft6.json' ``` --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index edd65a31..2578f031 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -jsonschema>=2.4.0 +jsonschema==2.6.0 aiohttp>=2.3.3,<2.4.0 # pyup: ignore aiohttp-cors>=0.5.3,<0.6.0 # pyup: ignore yarl>=0.11 @@ -8,4 +8,4 @@ psutil>=3.0.0 zipstream>=1.1.4 typing>=3.5.3.0 # Otherwise yarl fails with python 3.4 prompt-toolkit==1.0.15 -async-timeout<3.0.0 # pyup: ignore; 3.0 drops support for python 3.4 \ No newline at end of file +async-timeout<3.0.0 # pyup: ignore; 3.0 drops support for python 3.4 From b5deb9d177b35785e8403f729bef5aa966eda51d Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 26 Feb 2019 16:46:02 +0700 Subject: [PATCH 02/13] Release v2.1.13 --- CHANGELOG | 15 +++++++++++++++ gns3server/crash_report.py | 2 +- gns3server/version.py | 5 ++--- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index bc8d5085..b13bdd1b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,20 @@ # Change Log +## 2.1.13 26/02/2019 + +* Force jsonschema dependency to 2.6.0 +* Less aggressive connections to uBridge. Ref #1289 +* Fix topology images (Pictures) disappearing from projects. Fixes #1514. +* Reset MAC addresses when duplicating a project. Fixes #1522 +* Fix API call to create a node from an appliance doesn't return the new node data. Fixes #1527 +* Detect invalid environment variable and send a warning when creating a Docker node. Ref #2683 +* Do not export/import symlinks for projects. Fixes #2699 +* Fix symlink not being created for duplicated IOU devices. Fixes https://github.com/GNS3/gns3-gui/issues/2699 +* Configure coresPerSocket value in VMX file for the GNS3 VM. Fixes https://github.com/GNS3/gns3-gui/issues/2688 +* Count logical CPUs to detect if the number of vCPUs is too high when configuring the GNS3 VM. Fixes #2688. +* Add explicit error when trying to pull a Docker image from Docker Hub without Internet access. Fixes #1506. +* Fixes double display output in GRUB in QEMU v3.1. Fixes #1516. + ## 2.1.12 23/01/2019 * Tune how to get the size of SVG images. Ref https://github.com/GNS3/gns3-gui/issues/2674. diff --git a/gns3server/crash_report.py b/gns3server/crash_report.py index ff631963..ef6766b4 100644 --- a/gns3server/crash_report.py +++ b/gns3server/crash_report.py @@ -57,7 +57,7 @@ class CrashReport: Report crash to a third party service """ - DSN = "https://edb72a54588b4d04afc2de56b8cb5b24:7830885c8a2a4d0cb311de10ddfe3d27@sentry.io/38482" + DSN = "https://f4b829dcc310479882c429a04ec8e05e:e429c6d7e7d346d0b539da15fb737055@sentry.io/38482" if hasattr(sys, "frozen"): cacert = get_resource("cacert.pem") if cacert is not None and os.path.isfile(cacert): diff --git a/gns3server/version.py b/gns3server/version.py index 5c7e2b08..daf3b56c 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -23,9 +23,8 @@ # or negative for a release candidate or beta (after the base version # number has been incremented) -__version__ = "2.1.13dev1" -__version_info__ = (2, 1, 13, 9) - +__version__ = "2.1.13" +__version_info__ = (2, 1, 13, 0) # If it's a git checkout try to add the commit if "dev" in __version__: try: From 01481cde1fad012fe66a7322141e2ce2d4f560bb Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 26 Feb 2019 18:10:23 +0700 Subject: [PATCH 03/13] Development on 2.1.14dev1 --- gns3server/version.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gns3server/version.py b/gns3server/version.py index daf3b56c..d71ea144 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -23,8 +23,9 @@ # or negative for a release candidate or beta (after the base version # number has been incremented) -__version__ = "2.1.13" -__version_info__ = (2, 1, 13, 0) +__version__ = "2.1.14dev1" +__version_info__ = (2, 1, 14, 99) + # If it's a git checkout try to add the commit if "dev" in __version__: try: From 879e32eb9ac54fe1f34a5b68e4942ad017d1b40a Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 26 Feb 2019 23:19:33 +0700 Subject: [PATCH 04/13] Bump ACPI Shutdown Timeout to 120 seconds. Ref #1536 --- gns3server/compute/qemu/qemu_vm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gns3server/compute/qemu/qemu_vm.py b/gns3server/compute/qemu/qemu_vm.py index 4ee17f8a..9f2e5182 100644 --- a/gns3server/compute/qemu/qemu_vm.py +++ b/gns3server/compute/qemu/qemu_vm.py @@ -974,7 +974,7 @@ class QemuVM(BaseNode): try: if self.acpi_shutdown: yield from self._control_vm("system_powerdown") - yield from gns3server.utils.asyncio.wait_for_process_termination(self._process, timeout=30) + yield from gns3server.utils.asyncio.wait_for_process_termination(self._process, timeout=120) else: self._process.terminate() yield from gns3server.utils.asyncio.wait_for_process_termination(self._process, timeout=3) From 7aae682f0a1f20ded160555f4f05f50b45f45aad Mon Sep 17 00:00:00 2001 From: grossmj Date: Wed, 27 Feb 2019 14:47:45 +0700 Subject: [PATCH 05/13] Fix issue when setting cpuid.corespersocket for the GNS3 VM. Fixes https://github.com/GNS3/gns3-gui/issues/2723 --- gns3server/controller/gns3vm/vmware_gns3_vm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gns3server/controller/gns3vm/vmware_gns3_vm.py b/gns3server/controller/gns3vm/vmware_gns3_vm.py index cd1915b9..2931de6d 100644 --- a/gns3server/controller/gns3vm/vmware_gns3_vm.py +++ b/gns3server/controller/gns3vm/vmware_gns3_vm.py @@ -76,11 +76,12 @@ class VMwareGNS3VM(BaseGNS3VM): if vcpus > available_vcpus: raise GNS3VMError("You have allocated too many vCPUs for the GNS3 VM! (max available is {} vCPUs)".format(available_vcpus)) - cores_per_sockets = int(available_vcpus / psutil.cpu_count(logical=False)) try: pairs = VMware.parse_vmware_file(self._vmx_path) pairs["numvcpus"] = str(vcpus) - pairs["cpuid.coresPerSocket"] = str(cores_per_sockets) + cores_per_sockets = int(available_vcpus / psutil.cpu_count(logical=False)) + if cores_per_sockets >= 1: + pairs["cpuid.corespersocket"] = str(cores_per_sockets) pairs["memsize"] = str(ram) VMware.write_vmx_file(self._vmx_path, pairs) log.info("GNS3 VM vCPU count set to {} and RAM amount set to {}".format(vcpus, ram)) From 32f5dbb6453091619cf0d5ba2e12147cd74c4215 Mon Sep 17 00:00:00 2001 From: grossmj Date: Wed, 27 Feb 2019 14:58:52 +0700 Subject: [PATCH 06/13] Release v2.1.14 --- CHANGELOG | 5 +++++ gns3server/crash_report.py | 2 +- gns3server/version.py | 5 ++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index b13bdd1b..f2680b73 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,10 @@ # Change Log +## 2.1.14 27/02/2019 + +* Fix issue when setting cpuid.corespersocket for the GNS3 VM. Fixes https://github.com/GNS3/gns3-gui/issues/2723 +* Bump ACPI Shutdown Timeout to 120 seconds. Ref #1536 + ## 2.1.13 26/02/2019 * Force jsonschema dependency to 2.6.0 diff --git a/gns3server/crash_report.py b/gns3server/crash_report.py index ef6766b4..547c9c02 100644 --- a/gns3server/crash_report.py +++ b/gns3server/crash_report.py @@ -57,7 +57,7 @@ class CrashReport: Report crash to a third party service """ - DSN = "https://f4b829dcc310479882c429a04ec8e05e:e429c6d7e7d346d0b539da15fb737055@sentry.io/38482" + DSN = "https://3abf3feab0b14c51bfecaa170e846bb9:54b92432fbe94f0e9afe4cbf0dad0126@sentry.io/38482" if hasattr(sys, "frozen"): cacert = get_resource("cacert.pem") if cacert is not None and os.path.isfile(cacert): diff --git a/gns3server/version.py b/gns3server/version.py index d71ea144..96c98859 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -23,9 +23,8 @@ # or negative for a release candidate or beta (after the base version # number has been incremented) -__version__ = "2.1.14dev1" -__version_info__ = (2, 1, 14, 99) - +__version__ = "2.1.14" +__version_info__ = (2, 1, 14, 0) # If it's a git checkout try to add the commit if "dev" in __version__: try: From 4eca82174dd68bbb0fe02f011ce54a52af1833b8 Mon Sep 17 00:00:00 2001 From: grossmj Date: Wed, 27 Feb 2019 15:59:16 +0700 Subject: [PATCH 07/13] Development on 2.1.15dev1 --- gns3server/version.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gns3server/version.py b/gns3server/version.py index 96c98859..1bbb3f80 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -23,8 +23,9 @@ # or negative for a release candidate or beta (after the base version # number has been incremented) -__version__ = "2.1.14" -__version_info__ = (2, 1, 14, 0) +__version__ = "2.1.15dev1" +__version_info__ = (2, 1, 15, 99) + # If it's a git checkout try to add the commit if "dev" in __version__: try: From 5b6011a24852988ca047321f6d3a8609716bcdc7 Mon Sep 17 00:00:00 2001 From: grossmj Date: Fri, 1 Mar 2019 17:26:23 +0700 Subject: [PATCH 08/13] Stay with jsonschema 2.6.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1e2a0e2b..959f9adc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -jsonschema==2.6.0 +jsonschema==2.6.0 # pyup: ignore aiohttp==3.5.4 aiohttp-cors==0.7.0 Jinja2>=2.7.3 From 3f7c4c04743f03205958fa1a1d640e378fa59d4f Mon Sep 17 00:00:00 2001 From: Jeremy Grossmann Date: Fri, 1 Mar 2019 23:40:32 +0700 Subject: [PATCH 09/13] Update qemu_vm.py --- gns3server/compute/qemu/qemu_vm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gns3server/compute/qemu/qemu_vm.py b/gns3server/compute/qemu/qemu_vm.py index 03516cb7..a7f21ada 100644 --- a/gns3server/compute/qemu/qemu_vm.py +++ b/gns3server/compute/qemu/qemu_vm.py @@ -984,7 +984,7 @@ class QemuVM(BaseNode): log.info("QEMU process has stopped, return code: %d", returncode) await self.stop() # A return code of 1 seem fine on Windows - if returncode != 0 and (returncode != 1 or not sys.platform.startswith("win")): + if returncode != 0 and (not sys.platform.startswith("win") or returncode != 1): self.project.emit("log.error", {"message": "QEMU process has stopped, return code: {}\n{}".format(returncode, self.read_stdout())}) async def stop(self): From 724eda1f355c2cb83261b668757e2454dc7e4904 Mon Sep 17 00:00:00 2001 From: grossmj Date: Sat, 2 Mar 2019 16:26:40 +0700 Subject: [PATCH 10/13] Handle locking/unlocking items independently from the layer position. --- gns3server/controller/drawing.py | 13 ++++++++++++- gns3server/controller/node.py | 13 ++++++++++++- gns3server/controller/topology.py | 4 ++-- gns3server/schemas/drawing.py | 4 ++++ gns3server/schemas/node.py | 8 ++++++++ tests/controller/test_drawing.py | 2 ++ tests/controller/test_node.py | 2 ++ 7 files changed, 42 insertions(+), 4 deletions(-) diff --git a/gns3server/controller/drawing.py b/gns3server/controller/drawing.py index 58605e6d..4ef324b4 100644 --- a/gns3server/controller/drawing.py +++ b/gns3server/controller/drawing.py @@ -37,7 +37,7 @@ class Drawing: text, images, rectangle... They are pure SVG elements. """ - def __init__(self, project, drawing_id=None, svg="", x=0, y=0, z=2, rotation=0): + def __init__(self, project, drawing_id=None, svg="", x=0, y=0, z=2, locked=False, rotation=0): self._project = project if drawing_id is None: self._id = str(uuid.uuid4()) @@ -49,6 +49,7 @@ class Drawing: self._y = y self._z = z self._rotation = rotation + self._locked = locked @property def id(self): @@ -157,6 +158,14 @@ class Drawing: def z(self, val): self._z = val + @property + def locked(self): + return self._locked + + @locked.setter + def locked(self, val): + self._locked = val + @property def rotation(self): return self._rotation @@ -198,6 +207,7 @@ class Drawing: "x": self._x, "y": self._y, "z": self._z, + "locked": self._locked, "rotation": self._rotation, "svg": self._svg } @@ -207,6 +217,7 @@ class Drawing: "x": self._x, "y": self._y, "z": self._z, + "locked": self._locked, "rotation": self._rotation, "svg": self.svg } diff --git a/gns3server/controller/node.py b/gns3server/controller/node.py index 60e70c01..fb8576a3 100644 --- a/gns3server/controller/node.py +++ b/gns3server/controller/node.py @@ -34,7 +34,7 @@ log = logging.getLogger(__name__) class Node: # This properties are used only on controller and are not forwarded to the compute - CONTROLLER_ONLY_PROPERTIES = ["x", "y", "z", "width", "height", "symbol", "label", "console_host", + CONTROLLER_ONLY_PROPERTIES = ["x", "y", "z", "locked", "width", "height", "symbol", "label", "console_host", "port_name_format", "first_port_name", "port_segment_size", "ports", "category", "console_auto_start"] @@ -74,6 +74,7 @@ class Node: self._x = 0 self._y = 0 self._z = 1 # default z value is 1 + self._locked = False self._ports = None self._symbol = None self._custom_adapters = [] @@ -236,6 +237,14 @@ class Node: def z(self, val): self._z = val + @property + def locked(self): + return self._locked + + @locked.setter + def locked(self, val): + self._locked = val + @property def width(self): return self._width @@ -681,6 +690,7 @@ class Node: "x": self._x, "y": self._y, "z": self._z, + "locked": self._locked, "width": self._width, "height": self._height, "symbol": self._symbol, @@ -708,6 +718,7 @@ class Node: "x": self._x, "y": self._y, "z": self._z, + "locked": self._locked, "width": self._width, "height": self._height, "symbol": self._symbol, diff --git a/gns3server/controller/topology.py b/gns3server/controller/topology.py index 50f150ed..bdde30d9 100644 --- a/gns3server/controller/topology.py +++ b/gns3server/controller/topology.py @@ -160,7 +160,7 @@ def load_topology(path): topo = _convert_2_1_0(topo, path) # Version GNS3 2.2 dev (for project created with 2.2dev). - # Appliance ID has been repleace by Template ID + # Appliance ID has been replaced by Template ID if topo["revision"] == 9: for node in topo.get("topology", {}).get("nodes", []): if "appliance_id" in node: @@ -177,7 +177,7 @@ def load_topology(path): try: with open(path, "w+", encoding="utf-8") as f: json.dump(topo, f, indent=4, sort_keys=True) - except (OSError) as e: + except OSError as e: raise aiohttp.web.HTTPConflict(text="Can't write the topology {}: {}".format(path, str(e))) return topo diff --git a/gns3server/schemas/drawing.py b/gns3server/schemas/drawing.py index b15a5e3c..37f8fd6c 100644 --- a/gns3server/schemas/drawing.py +++ b/gns3server/schemas/drawing.py @@ -47,6 +47,10 @@ DRAWING_OBJECT_SCHEMA = { "description": "Z property", "type": "integer" }, + "locked": { + "description": "Whether the element locked or not", + "type": "boolean" + }, "rotation": { "description": "Rotation of the element", "type": "integer", diff --git a/gns3server/schemas/node.py b/gns3server/schemas/node.py index 55ae1d05..b48372ed 100644 --- a/gns3server/schemas/node.py +++ b/gns3server/schemas/node.py @@ -193,6 +193,10 @@ NODE_OBJECT_SCHEMA = { "description": "Z position of the node", "type": "integer" }, + "locked": { + "description": "Whether the element locked or not", + "type": "boolean" + }, "port_name_format": { "description": "Formating for port name {0} will be replace by port number", "type": "string" @@ -280,6 +284,10 @@ NODE_DUPLICATE_SCHEMA = { "z": { "description": "Z position of the node", "type": "integer" + }, + "locked": { + "description": "Whether the element locked or not", + "type": "boolean" } }, "additionalProperties": False, diff --git a/tests/controller/test_drawing.py b/tests/controller/test_drawing.py index 4a934923..5b5ffbfb 100644 --- a/tests/controller/test_drawing.py +++ b/tests/controller/test_drawing.py @@ -56,6 +56,7 @@ def test_json(project): "x": i.x, "y": i.y, "z": i.z, + "locked": i.locked, "svg": i.svg, "rotation": i.rotation } @@ -65,6 +66,7 @@ def test_json(project): "y": i.y, "z": i.z, "rotation": i.rotation, + "locked": i.locked, "svg": i.svg } diff --git a/tests/controller/test_node.py b/tests/controller/test_node.py index 7ed82881..e72b1db4 100644 --- a/tests/controller/test_node.py +++ b/tests/controller/test_node.py @@ -135,6 +135,7 @@ def test_json(node, compute): "x": node.x, "y": node.y, "z": node.z, + "locked": node.locked, "width": node.width, "height": node.height, "symbol": node.symbol, @@ -167,6 +168,7 @@ def test_json(node, compute): "x": node.x, "y": node.y, "z": node.z, + "locked": node.locked, "width": node.width, "height": node.height, "symbol": node.symbol, From 3f679bd106d1a4ff194c44d9807e227309c98383 Mon Sep 17 00:00:00 2001 From: grossmj Date: Sat, 2 Mar 2019 16:39:05 +0700 Subject: [PATCH 11/13] Locked state should not be used when duplicating a node. --- gns3server/controller/project.py | 1 + gns3server/schemas/node.py | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/gns3server/controller/project.py b/gns3server/controller/project.py index a7407a69..f163a92c 100644 --- a/gns3server/controller/project.py +++ b/gns3server/controller/project.py @@ -1070,6 +1070,7 @@ class Project: data['x'] = x data['y'] = y data['z'] = z + data['locked'] = False # duplicated node must not be locked new_node_uuid = str(uuid.uuid4()) new_node = await self.add_node( node.compute, diff --git a/gns3server/schemas/node.py b/gns3server/schemas/node.py index b48372ed..5d3cc11a 100644 --- a/gns3server/schemas/node.py +++ b/gns3server/schemas/node.py @@ -284,10 +284,6 @@ NODE_DUPLICATE_SCHEMA = { "z": { "description": "Z position of the node", "type": "integer" - }, - "locked": { - "description": "Whether the element locked or not", - "type": "boolean" } }, "additionalProperties": False, From 69ba0ccf771fd9d70904b62f76b0400aea792229 Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 4 Mar 2019 14:48:57 +0700 Subject: [PATCH 12/13] Bump version to 2.2.0dev2 --- gns3server/version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/version.py b/gns3server/version.py index d2b3ff3a..e1b3606f 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -23,8 +23,8 @@ # or negative for a release candidate or beta (after the base version # number has been incremented) -__version__ = "2.2.0a1" -__version_info__ = (2, 2, 0, -99) +__version__ = "2.2.0dev2" +__version_info__ = (2, 2, 0, 99) # If it's a git checkout try to add the commit if "dev" in __version__: From 4c83fc12437e737d34a1bd324d9d4679d91d1840 Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 4 Mar 2019 16:07:04 +0700 Subject: [PATCH 13/13] Update paths for binaries moved to the MacOS directory in GNS3.app --- gns3server/compute/qemu/__init__.py | 4 ++-- gns3server/version.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gns3server/compute/qemu/__init__.py b/gns3server/compute/qemu/__init__.py index cf37224b..922064e8 100644 --- a/gns3server/compute/qemu/__init__.py +++ b/gns3server/compute/qemu/__init__.py @@ -100,10 +100,10 @@ class Qemu(BaseManager): paths.update(["/usr/bin", "/usr/local/bin", "/opt/local/bin"]) try: exec_dir = os.path.dirname(os.path.abspath(sys.executable)) - paths.add(os.path.abspath(os.path.join(exec_dir, "../Resources/qemu/bin/"))) + paths.add(os.path.abspath(os.path.join(exec_dir, "qemu/bin"))) # If the user run the server by hand from outside except FileNotFoundError: - paths.add("/Applications/GNS3.app/Contents/Resources/qemu/bin") + paths.add("/Applications/GNS3.app/Contents/MacOS/qemu/bin") return paths @staticmethod diff --git a/gns3server/version.py b/gns3server/version.py index e1b3606f..dfb19bce 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -23,7 +23,7 @@ # or negative for a release candidate or beta (after the base version # number has been incremented) -__version__ = "2.2.0dev2" +__version__ = "2.2.0dev6" __version_info__ = (2, 2, 0, 99) # If it's a git checkout try to add the commit