mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-26 00:38:10 +00:00
Fixes small issues when deleting Dynamips devices.
This commit is contained in:
parent
f12d3f07f7
commit
349d9d4540
@ -116,7 +116,8 @@ class ATMSwitch(Device):
|
||||
log.info('ATM switch "{name}" [{id}] has been deleted'.format(name=self._name, id=self._id))
|
||||
except DynamipsError:
|
||||
log.debug("Could not properly delete ATM switch {}".format(self._name))
|
||||
self._hypervisor.devices.remove(self)
|
||||
if self._hypervisor and self in self._hypervisor.devices:
|
||||
self._hypervisor.devices.remove(self)
|
||||
if self._hypervisor and not self._hypervisor.devices:
|
||||
yield from self.hypervisor.stop()
|
||||
|
||||
|
@ -80,8 +80,10 @@ class Bridge(Device):
|
||||
Deletes this bridge.
|
||||
"""
|
||||
|
||||
self._hypervisor.devices.remove(self)
|
||||
yield from self._hypervisor.send('nio_bridge delete "{}"'.format(self._name))
|
||||
if self._hypervisor and self in self._hypervisor.devices:
|
||||
self._hypervisor.devices.remove(self)
|
||||
if self._hypervisor and not self._hypervisor.devices:
|
||||
yield from self._hypervisor.send('nio_bridge delete "{}"'.format(self._name))
|
||||
|
||||
@asyncio.coroutine
|
||||
def add_nio(self, nio):
|
||||
|
@ -74,7 +74,7 @@ class EthernetHub(Bridge):
|
||||
Deletes this hub.
|
||||
"""
|
||||
|
||||
for nio in self._nios.values():
|
||||
for nio in self._nios:
|
||||
if nio and isinstance(nio, NIOUDP):
|
||||
self.manager.port_manager.release_udp_port(nio.lport)
|
||||
|
||||
|
@ -124,7 +124,8 @@ class EthernetSwitch(Device):
|
||||
log.info('Ethernet switch "{name}" [{id}] has been deleted'.format(name=self._name, id=self._id))
|
||||
except DynamipsError:
|
||||
log.debug("Could not properly delete Ethernet switch {}".format(self._name))
|
||||
self._hypervisor.devices.remove(self)
|
||||
if self._hypervisor and self in self._hypervisor.devices:
|
||||
self._hypervisor.devices.remove(self)
|
||||
if self._hypervisor and not self._hypervisor.devices:
|
||||
yield from self.hypervisor.stop()
|
||||
|
||||
|
@ -115,7 +115,8 @@ class FrameRelaySwitch(Device):
|
||||
log.info('Frame Relay switch "{name}" [{id}] has been deleted'.format(name=self._name, id=self._id))
|
||||
except DynamipsError:
|
||||
log.debug("Could not properly delete Frame relay switch {}".format(self._name))
|
||||
self._hypervisor.devices.remove(self)
|
||||
if self._hypervisor and self in self._hypervisor.devices:
|
||||
self._hypervisor.devices.remove(self)
|
||||
if self._hypervisor and not self._hypervisor.devices:
|
||||
yield from self.hypervisor.stop()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user