1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Ensure we start only one ubridge

Fix https://github.com/GNS3/gns3-gui/issues/1964
This commit is contained in:
Julien Duponchelle 2017-03-28 16:27:09 +02:00
parent 84da9b4c23
commit 644616b69c
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -28,7 +28,7 @@ import platform
from gns3server.utils.interfaces import interfaces from gns3server.utils.interfaces import interfaces
from ..compute.port_manager import PortManager from ..compute.port_manager import PortManager
from ..utils.asyncio import wait_run_in_executor from ..utils.asyncio import wait_run_in_executor, locked_coroutine
from ..utils.asyncio.telnet_server import AsyncioTelnetServer from ..utils.asyncio.telnet_server import AsyncioTelnetServer
from ..ubridge.hypervisor import Hypervisor from ..ubridge.hypervisor import Hypervisor
from ..ubridge.ubridge_error import UbridgeError from ..ubridge.ubridge_error import UbridgeError
@ -519,12 +519,16 @@ class BaseNode:
except UbridgeError as e: except UbridgeError as e:
raise UbridgeError("{}: {}".format(e, self._ubridge_hypervisor.read_stdout())) raise UbridgeError("{}: {}".format(e, self._ubridge_hypervisor.read_stdout()))
@asyncio.coroutine @locked_coroutine
def _start_ubridge(self): def _start_ubridge(self):
""" """
Starts uBridge (handles connections to and from this node). Starts uBridge (handles connections to and from this node).
""" """
# Prevent us to start multiple ubridge
if self._ubridge_hypervisor and self._ubridge_hypervisor.is_running():
return
if self.ubridge_path is None: if self.ubridge_path is None:
raise NodeError("uBridge is not available, path doesn't exist, or you just installed GNS3 and need to restart your user session to refresh user permissions.") raise NodeError("uBridge is not available, path doesn't exist, or you just installed GNS3 and need to restart your user session to refresh user permissions.")