1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-23 23:38:21 +00:00

Allow cloud nodes to be exported. Fixes #1519

This commit is contained in:
grossmj 2019-02-23 11:07:01 +07:00
parent 4487e578bc
commit 2fb5e47c8d
2 changed files with 6 additions and 12 deletions

View File

@ -292,9 +292,9 @@ class Cloud(BaseNode):
if not isinstance(nio, NIOUDP):
raise NodeError("Source NIO is not UDP")
await self._ubridge_send('bridge add_nio_udp {name} {lport} {rhost} {rport}'.format(name=bridge_name,
lport=nio.lport,
rhost=nio.rhost,
rport=nio.rport))
lport=nio.lport,
rhost=nio.rhost,
rport=nio.rport))
await self._ubridge_apply_filters(bridge_name, nio.filters)
if port_info["type"] in ("ethernet", "tap"):
@ -309,7 +309,7 @@ class Cloud(BaseNode):
if port_info["type"] == "ethernet":
network_interfaces = [interface["name"] for interface in self._interfaces()]
if not port_info["interface"] in network_interfaces:
raise NodeError("Interface '{}' could not be found on this system".format(port_info["interface"]))
raise NodeError("Interface '{}' could not be found on this system, please update '{}'".format(port_info["interface"], self.name))
if sys.platform.startswith("linux"):
await self._add_linux_ethernet(port_info, bridge_name)
@ -401,17 +401,11 @@ class Cloud(BaseNode):
await self.start()
await self._add_ubridge_connection(nio, port_number)
self._nios[port_number] = nio
except NodeError as e:
self.project.emit("log.error", {"message": str(e)})
except (NodeError, UbridgeError) as e:
await self._stop_ubridge()
self.status = "stopped"
self._nios[port_number] = nio
# Cleanup stuff
except UbridgeError as e:
self.project.emit("log.error", {"message": str(e)})
await self._stop_ubridge()
self.status = "stopped"
self._nios[port_number] = nio
async def update_nio(self, port_number, nio):
"""

View File

@ -183,7 +183,7 @@ async def _patch_project_file(project, path, zstream, include_images, keep_compu
if node["node_type"] == "virtualbox" and node.get("properties", {}).get("linked_clone"):
raise aiohttp.web.HTTPConflict(text="Projects with a linked {} clone node cannot not be exported. Please use Qemu instead.".format(node["node_type"]))
if not allow_all_nodes and node["node_type"] in ["virtualbox", "vmware", "cloud"]:
if not allow_all_nodes and node["node_type"] in ["virtualbox", "vmware"]:
raise aiohttp.web.HTTPConflict(text="Projects with a {} node cannot be exported".format(node["node_type"]))
if not keep_compute_id: