From a191029c4f364ee9bcbc28fb6adf9fae9aaedb63 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 14 Feb 2017 14:45:48 +0100 Subject: [PATCH] Fix linked_clone property lost during topology convert --- gns3server/controller/topology.py | 2 ++ tests/controller/test_export_project.py | 24 +++++++++---------- .../1_5_virtualbox/after/1_5_virtualbox.gns3 | 1 + .../1_5_vmware/after/1_5_vmware.gns3 | 1 + 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/gns3server/controller/topology.py b/gns3server/controller/topology.py index 3f7a1540..c188e9a9 100644 --- a/gns3server/controller/topology.py +++ b/gns3server/controller/topology.py @@ -321,10 +321,12 @@ def _convert_1_3_later(topo, topo_path): node["properties"]["ram"] = PLATFORMS_DEFAULT_RAM[old_node["type"].lower()] elif old_node["type"] == "VMwareVM": node["node_type"] = "vmware" + node["properties"]["linked_clone"] = old_node.get("linked_clone", False) if node["symbol"] is None: node["symbol"] = ":/symbols/vmware_guest.svg" elif old_node["type"] == "VirtualBoxVM": node["node_type"] = "virtualbox" + node["properties"]["linked_clone"] = old_node.get("linked_clone", False) if node["symbol"] is None: node["symbol"] = ":/symbols/vbox_guest.svg" elif old_node["type"] == "IOUDevice": diff --git a/tests/controller/test_export_project.py b/tests/controller/test_export_project.py index 65b1e80f..da7c3c1d 100644 --- a/tests/controller/test_export_project.py +++ b/tests/controller/test_export_project.py @@ -202,7 +202,7 @@ def test_export_disallow_some_type(tmpdir, project, async_run): with pytest.raises(aiohttp.web.HTTPConflict): z = async_run(export_project(project, str(tmpdir))) - z = async_run(export_project(project, str(tmpdir), allow_all_nodes=True)) + z = async_run(export_project(project, str(tmpdir), allow_all_nodes=True)) def test_export_fix_path(tmpdir, project, async_run): @@ -215,18 +215,18 @@ def test_export_fix_path(tmpdir, project, async_run): topology = { "topology": { "nodes": [ - { - "properties": { - "image": "/tmp/c3725-adventerprisek9-mz.124-25d.image" - }, - "node_type": "dynamips" - }, { - "properties": { - "image": "gns3/webterm:lastest" - }, - "node_type": "docker" - } + "properties": { + "image": "/tmp/c3725-adventerprisek9-mz.124-25d.image" + }, + "node_type": "dynamips" + }, + { + "properties": { + "image": "gns3/webterm:lastest" + }, + "node_type": "docker" + } ] } } diff --git a/tests/topologies/1_5_virtualbox/after/1_5_virtualbox.gns3 b/tests/topologies/1_5_virtualbox/after/1_5_virtualbox.gns3 index 1f591b24..ba17e46d 100644 --- a/tests/topologies/1_5_virtualbox/after/1_5_virtualbox.gns3 +++ b/tests/topologies/1_5_virtualbox/after/1_5_virtualbox.gns3 @@ -34,6 +34,7 @@ "port_segment_size": 0, "first_port_name": null, "properties": { + "linked_clone": false, "acpi_shutdown": false, "adapter_type": "Intel PRO/1000 MT Desktop (82540EM)", "adapters": 1, diff --git a/tests/topologies/1_5_vmware/after/1_5_vmware.gns3 b/tests/topologies/1_5_vmware/after/1_5_vmware.gns3 index 98a25f62..8238605c 100644 --- a/tests/topologies/1_5_vmware/after/1_5_vmware.gns3 +++ b/tests/topologies/1_5_vmware/after/1_5_vmware.gns3 @@ -34,6 +34,7 @@ "port_segment_size": 0, "first_port_name": null, "properties": { + "linked_clone": false, "acpi_shutdown": false, "adapter_type": "e1000", "adapters": 1,