Catch an error in etherswitch when ubridge die

Fix #907
This commit is contained in:
Julien Duponchelle 2017-02-20 12:19:38 +01:00
parent 7407ab88b3
commit 132a7bfeb7
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -211,7 +211,8 @@ class EthernetSwitch(Device):
nio = self._nios[port_number]
if isinstance(nio, NIOUDP):
self.manager.port_manager.release_udp_port(nio.lport, self._project)
yield from self._hypervisor.send('ethsw remove_nio "{name}" {nio}'.format(name=self._name, nio=nio))
if self._hypervisor:
yield from self._hypervisor.send('ethsw remove_nio "{name}" {nio}'.format(name=self._name, nio=nio))
log.info('Ethernet switch "{name}" [{id}]: NIO {nio} removed from port {port}'.format(name=self._name,
id=self._id,