mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Fix a bug when selecting a topology and deleting multiple linked device
Fix https://github.com/GNS3/gns3-gui/issues/1554
This commit is contained in:
parent
99bdf37ec3
commit
6fa8c52482
@ -33,6 +33,7 @@ from .udp_link import UDPLink
|
|||||||
from ..config import Config
|
from ..config import Config
|
||||||
from ..utils.path import check_path_allowed, get_default_project_directory
|
from ..utils.path import check_path_allowed, get_default_project_directory
|
||||||
from ..utils.asyncio.pool import Pool
|
from ..utils.asyncio.pool import Pool
|
||||||
|
from ..utils.asyncio import locked_coroutine
|
||||||
from .export_project import export_project
|
from .export_project import export_project
|
||||||
from .import_project import import_project
|
from .import_project import import_project
|
||||||
|
|
||||||
@ -360,16 +361,23 @@ class Project:
|
|||||||
self.dump()
|
self.dump()
|
||||||
return node
|
return node
|
||||||
|
|
||||||
@open_required
|
@locked_coroutine
|
||||||
@asyncio.coroutine
|
def __delete_node_links(self, node):
|
||||||
def delete_node(self, node_id):
|
"""
|
||||||
|
Delete all link connected to this node.
|
||||||
node = self.get_node(node_id)
|
|
||||||
|
|
||||||
|
The operation use a lock to avoid cleaning links from
|
||||||
|
multiple nodes at the same time.
|
||||||
|
"""
|
||||||
for link in list(self._links.values()):
|
for link in list(self._links.values()):
|
||||||
if node in link.nodes:
|
if node in link.nodes:
|
||||||
yield from self.delete_link(link.id)
|
yield from self.delete_link(link.id)
|
||||||
|
|
||||||
|
@open_required
|
||||||
|
@asyncio.coroutine
|
||||||
|
def delete_node(self, node_id):
|
||||||
|
node = self.get_node(node_id)
|
||||||
|
yield from self.__delete_node_links(node)
|
||||||
self.remove_allocated_node_name(node.name)
|
self.remove_allocated_node_name(node.name)
|
||||||
del self._nodes[node.id]
|
del self._nodes[node.id]
|
||||||
yield from node.destroy()
|
yield from node.destroy()
|
||||||
|
Loading…
Reference in New Issue
Block a user