mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-19 07:53:47 +02:00
Allow cloud nodes to be exported. Fixes #1519
This commit is contained in:
parent
4487e578bc
commit
2fb5e47c8d
@ -292,9 +292,9 @@ class Cloud(BaseNode):
|
|||||||
if not isinstance(nio, NIOUDP):
|
if not isinstance(nio, NIOUDP):
|
||||||
raise NodeError("Source NIO is not UDP")
|
raise NodeError("Source NIO is not UDP")
|
||||||
await self._ubridge_send('bridge add_nio_udp {name} {lport} {rhost} {rport}'.format(name=bridge_name,
|
await self._ubridge_send('bridge add_nio_udp {name} {lport} {rhost} {rport}'.format(name=bridge_name,
|
||||||
lport=nio.lport,
|
lport=nio.lport,
|
||||||
rhost=nio.rhost,
|
rhost=nio.rhost,
|
||||||
rport=nio.rport))
|
rport=nio.rport))
|
||||||
|
|
||||||
await self._ubridge_apply_filters(bridge_name, nio.filters)
|
await self._ubridge_apply_filters(bridge_name, nio.filters)
|
||||||
if port_info["type"] in ("ethernet", "tap"):
|
if port_info["type"] in ("ethernet", "tap"):
|
||||||
@ -309,7 +309,7 @@ class Cloud(BaseNode):
|
|||||||
if port_info["type"] == "ethernet":
|
if port_info["type"] == "ethernet":
|
||||||
network_interfaces = [interface["name"] for interface in self._interfaces()]
|
network_interfaces = [interface["name"] for interface in self._interfaces()]
|
||||||
if not port_info["interface"] in network_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"):
|
if sys.platform.startswith("linux"):
|
||||||
await self._add_linux_ethernet(port_info, bridge_name)
|
await self._add_linux_ethernet(port_info, bridge_name)
|
||||||
@ -401,17 +401,11 @@ class Cloud(BaseNode):
|
|||||||
await self.start()
|
await self.start()
|
||||||
await self._add_ubridge_connection(nio, port_number)
|
await self._add_ubridge_connection(nio, port_number)
|
||||||
self._nios[port_number] = nio
|
self._nios[port_number] = nio
|
||||||
except NodeError as e:
|
except (NodeError, UbridgeError) as e:
|
||||||
self.project.emit("log.error", {"message": str(e)})
|
|
||||||
await self._stop_ubridge()
|
await self._stop_ubridge()
|
||||||
self.status = "stopped"
|
self.status = "stopped"
|
||||||
self._nios[port_number] = nio
|
self._nios[port_number] = nio
|
||||||
# Cleanup stuff
|
|
||||||
except UbridgeError as e:
|
|
||||||
self.project.emit("log.error", {"message": str(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):
|
async def update_nio(self, port_number, nio):
|
||||||
"""
|
"""
|
||||||
|
@ -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"):
|
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"]))
|
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"]))
|
raise aiohttp.web.HTTPConflict(text="Projects with a {} node cannot be exported".format(node["node_type"]))
|
||||||
|
|
||||||
if not keep_compute_id:
|
if not keep_compute_id:
|
||||||
|
Loading…
Reference in New Issue
Block a user