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

Fix VPCS ubridge usage

This commit is contained in:
Julien Duponchelle 2017-07-12 09:55:23 +02:00
parent d112da400e
commit 04303ca00c
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -374,10 +374,8 @@ class VPCSVM(BaseNode):
raise VPCSError("Port {port_number} doesn't exist in adapter {adapter}".format(adapter=self._ethernet_adapter, raise VPCSError("Port {port_number} doesn't exist in adapter {adapter}".format(adapter=self._ethernet_adapter,
port_number=port_number)) port_number=port_number))
if not self._local_udp_tunnel: if self.is_running():
self._local_udp_tunnel = self._create_local_udp_tunnel() yield from self.add_ubridge_udp_connection("VPCS-{}".format(self._id), self._local_udp_tunnel[1], nio)
yield from self.add_ubridge_udp_connection("VPCS-{}".format(self._id), self._local_udp_tunnel[1], nio)
self._ethernet_adapter.add_nio(port_number, nio) self._ethernet_adapter.add_nio(port_number, nio)
log.info('VPCS "{name}" [{id}]: {nio} added to port {port_number}'.format(name=self._name, log.info('VPCS "{name}" [{id}]: {nio} added to port {port_number}'.format(name=self._name,
@ -392,9 +390,8 @@ class VPCSVM(BaseNode):
if not self._ethernet_adapter.port_exists(port_number): if not self._ethernet_adapter.port_exists(port_number):
raise VPCSError("Port {port_number} doesn't exist in adapter {adapter}".format(adapter=self._ethernet_adapter, raise VPCSError("Port {port_number} doesn't exist in adapter {adapter}".format(adapter=self._ethernet_adapter,
port_number=port_number)) port_number=port_number))
if not self._local_udp_tunnel: if self.is_running():
self._local_udp_tunnel = self._create_local_udp_tunnel() yield from self._update_ubridge_udp_connection("VPCS-{}".format(self._id), self._local_udp_tunnel[1], nio)
yield from self._update_ubridge_udp_connection("VPCS-{}".format(self._id), self._local_udp_tunnel[1], nio)
@asyncio.coroutine @asyncio.coroutine
def port_remove_nio_binding(self, port_number): def port_remove_nio_binding(self, port_number):
@ -410,7 +407,8 @@ class VPCSVM(BaseNode):
raise VPCSError("Port {port_number} doesn't exist in adapter {adapter}".format(adapter=self._ethernet_adapter, raise VPCSError("Port {port_number} doesn't exist in adapter {adapter}".format(adapter=self._ethernet_adapter,
port_number=port_number)) port_number=port_number))
yield from self._ubridge_send("bridge delete {name}".format(name="VPCS-{}".format(self._id))) if self.is_running():
yield from self._ubridge_send("bridge delete {name}".format(name="VPCS-{}".format(self._id)))
nio = self._ethernet_adapter.get_nio(port_number) nio = self._ethernet_adapter.get_nio(port_number)
if isinstance(nio, NIOUDP): if isinstance(nio, NIOUDP):