Fix bridge 'bridge0' already exist when we have trouble with a container

Fix #973
This commit is contained in:
Julien Duponchelle 2017-04-10 16:58:00 +02:00
parent 03a134af75
commit fdd1084714
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -361,6 +361,7 @@ class DockerVM(BaseNode):
try:
yield from self._add_ubridge_connection(nio, adapter_number)
except UbridgeNamespaceError:
log.error("Container {} failed to start", self.name)
yield from self.stop()
# The container can crash soon after the start, this means we can not move the interface to the container namespace
@ -517,6 +518,8 @@ class DockerVM(BaseNode):
state = yield from self._get_container_state()
if state == "running":
return True
if self.status == "started": # The container crashed we need to clean
yield from self.stop()
return False
@asyncio.coroutine