Merge branch 'master' into 2.0

This commit is contained in:
Julien Duponchelle committed 2016-07-05 15:41:53 +02:00
commit ca4d09ea40
6 files changed
+39 -13

No files matched your search

+1 -1
View File
@@ -114,7 +114,7 @@ class Docker(BaseManager):
data=data,
headers={"content-type": "application/json", },
)
except aiohttp.ClientResponseError as e:
except (aiohttp.ClientResponseError, aiohttp.ClientOSError) as e:
raise DockerError("Docker has returned an error: {}".format(str(e)))
if response.status >= 300:
body = yield from response.read()
+17 -3
View File
@@ -624,10 +624,10 @@ class DockerVM(BaseNode):
adapter_number=adapter_number))
for index in range(4096):
if "veth-gns3-ext{}".format(index) not in psutil.net_if_addrs():
if "veth-gns3-e{}".format(index) not in psutil.net_if_addrs():
adapter.ifc = "eth{}".format(str(index))
adapter.host_ifc = "veth-gns3-ext{}".format(str(index))
adapter.guest_ifc = "veth-gns3-int{}".format(str(index))
adapter.host_ifc = "veth-gns3-e{}".format(str(index))
adapter.guest_ifc = "veth-gns3-i{}".format(str(index))
break
if not hasattr(adapter, "ifc"):
raise DockerError("Adapter {adapter_number} couldn't allocate interface on Docker container '{name}'. Too many Docker interfaces already exists".format(name=self.name,
@@ -663,6 +663,8 @@ class DockerVM(BaseNode):
:param adapter_number: adapter number
"""
if not self.ubridge:
return
adapter = self._ethernet_adapters[adapter_number]
try:
@@ -704,6 +706,18 @@ class DockerVM(BaseNode):
yield from self._ubridge_send('bridge start bridge{adapter}'.format(adapter=adapter_number))
if self.status == "started" and self._ubridge_hypervisor and self._ubridge_hypervisor.is_running():
# the container is running, let's add the UDP tunnel to connect to another node
yield from self._ubridge_hypervisor.send('bridge create bridge{}'.format(adapter_number))
yield from self._ubridge_hypervisor.send('bridge add_nio_linux_raw bridge{adapter} {ifc}'.format(ifc=adapter.host_ifc, adapter=adapter_number))
yield from self._ubridge_hypervisor.send('bridge add_nio_udp bridge{adapter} {lport} {rhost} {rport}'.format(adapter=adapter_number,
lport=nio.lport,
rhost=nio.rhost,
rport=nio.rport))
yield from self._ubridge_hypervisor.send('bridge start bridge{adapter}'.format(adapter=adapter_number))
adapter.add_nio(0, nio)
log.info("Docker container '{name}' [{id}]: {nio} added to adapter {adapter_number}".format(name=self.name,
id=self._id,
+4 -1
View File
@@ -679,7 +679,10 @@ class IOUVM(BaseNode):
except asyncio.TimeoutError:
if self._iou_process.returncode is None:
log.warn("IOU process {} is still running... killing it".format(self._iou_process.pid))
self._iou_process.kill()
try:
self._iou_process.kill()
except ProcessLookupError:
pass
self._iou_process = None
if self.is_iouyap_running():
+1 -1
View File
@@ -187,7 +187,7 @@ class Route(object):
except aiohttp.web.HTTPBadRequest as e:
response = Response(request=request, route=route)
response.set_status(e.status)
response.json({"message": e.text, "status": e.status, "path": route, "request": request.json})
response.json({"message": e.text, "status": e.status, "path": route, "request": request.json, "method": request.method})
except aiohttp.web.HTTPException as e:
response = Response(request=request, route=route)
response.set_status(e.status)