Merge branch '1.5' into 2.0

This commit is contained in:
Julien Duponchelle 2016-06-15 19:14:03 +02:00
commit 2a1c5cfd9c
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
4 changed files with 44 additions and 14 deletions

View File

@ -1,5 +1,19 @@
# Change Log # Change Log
## 1.5.0rc2 15/06/2016
* Fix black screen with Qt app in Docker container
* Detect when command in the container exit
* Docker when the aux console exit and restart it
* Pass by default the environment variable container=docker
* Fix busybox binary location
* Avoid loosing console port for Docker
* Workaround a crash in x11vnc
* Delete volume when dropping the container
* Catch connection reset in ioucon
* Delete vlan.dat for L2IOL during config import. Fixes #1285.
* Copy original ressources from VOLUMES
## 1.5.0rc1 01/06/2016 ## 1.5.0rc1 01/06/2016
* Save an restore docker permission * Save an restore docker permission

View File

@ -18,6 +18,10 @@ it on https://github.com/GNS3/gns3-gui we will take care of the triage.
For bugs specific to the GNS3 VM, please report on https://github.com/GNS3/gns3-vm For bugs specific to the GNS3 VM, please report on https://github.com/GNS3/gns3-vm
## Security issues
For security issues please keep it private and send an email to developers@gns3.net
## Asking for new features ## Asking for new features
The best is to start a discussion on the community website in order to get feedback The best is to start a discussion on the community website in order to get feedback

View File

@ -279,7 +279,7 @@ class DockerVM(BaseNode):
"Binds": self._mount_binds(image_infos) "Binds": self._mount_binds(image_infos)
}, },
"Volumes": {}, "Volumes": {},
"Env": [], "Env": ["container=docker"], # Systemd compliant: https://github.com/GNS3/gns3-server/issues/573
"Cmd": [], "Cmd": [],
"Entrypoint": image_infos.get("Config", {"Entrypoint": []})["Entrypoint"] "Entrypoint": image_infos.get("Config", {"Entrypoint": []})["Entrypoint"]
} }
@ -306,6 +306,7 @@ class DockerVM(BaseNode):
if self._console_type == "vnc": if self._console_type == "vnc":
yield from self._start_vnc() yield from self._start_vnc()
params["Env"].append("QT_GRAPHICSSYSTEM=native") # To fix a Qt issue: https://github.com/GNS3/gns3-server/issues/556
params["Env"].append("DISPLAY=:{}".format(self._display)) params["Env"].append("DISPLAY=:{}".format(self._display))
params["HostConfig"]["Binds"].append("/tmp/.X11-unix/:/tmp/.X11-unix/") params["HostConfig"]["Binds"].append("/tmp/.X11-unix/:/tmp/.X11-unix/")
@ -384,7 +385,7 @@ class DockerVM(BaseNode):
# We can not use the API because docker doesn't expose a websocket api for exec # We can not use the API because docker doesn't expose a websocket api for exec
# https://github.com/GNS3/gns3-gui/issues/1039 # https://github.com/GNS3/gns3-gui/issues/1039
process = yield from asyncio.subprocess.create_subprocess_exec( process = yield from asyncio.subprocess.create_subprocess_exec(
"docker", "exec", "-i", self._cid, "/gns3/bin/busybox", "script", "-qfc", "/gns3/bin/busybox sh", "/dev/null", "docker", "exec", "-i", self._cid, "/gns3/bin/busybox", "script", "-qfc", "while true; do /gns3/bin/busybox sh; done", "/dev/null",
stdout=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.STDOUT, stderr=asyncio.subprocess.STDOUT,
stdin=asyncio.subprocess.PIPE) stdin=asyncio.subprocess.PIPE)
@ -493,7 +494,9 @@ class DockerVM(BaseNode):
out.feed_eof() out.feed_eof()
ws.close() ws.close()
break break
yield from self.stop()
@asyncio.coroutine
def is_running(self): def is_running(self):
"""Checks if the container is running. """Checks if the container is running.
@ -535,21 +538,21 @@ class DockerVM(BaseNode):
if state == "paused": if state == "paused":
yield from self.unpause() yield from self.unpause()
yield from self._fix_permissions() if state != "stopped":
yield from self._fix_permissions()
# t=5 number of seconds to wait before killing the container # t=5 number of seconds to wait before killing the container
try: try:
yield from self.manager.query("POST", "containers/{}/stop".format(self._cid), params={"t": 5}) yield from self.manager.query("POST", "containers/{}/stop".format(self._cid), params={"t": 5})
log.info("Docker container '{name}' [{image}] stopped".format(name=self._name, image=self._image)) log.info("Docker container '{name}' [{image}] stopped".format(
except DockerHttp304Error: name=self._name, image=self._image))
# Container is already stopped except DockerHttp304Error:
pass # Container is already stopped
finally: pass
self.status = "stopped"
# Ignore runtime error because when closing the server # Ignore runtime error because when closing the server
except RuntimeError as e: except RuntimeError as e:
log.debug("Docker runtime error when closing: {}".format(str(e))) log.debug("Docker runtime error when closing: {}".format(str(e)))
return return
self.status = "stopped"
@asyncio.coroutine @asyncio.coroutine
def pause(self): def pause(self):

View File

@ -105,6 +105,7 @@ def test_create(loop, project, manager):
"Hostname": "test", "Hostname": "test",
"Image": "ubuntu:latest", "Image": "ubuntu:latest",
"Env": [ "Env": [
"container=docker",
"GNS3_MAX_ETHERNET=eth0", "GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network" "GNS3_VOLUMES=/etc/network"
], ],
@ -143,6 +144,7 @@ def test_create_with_tag(loop, project, manager):
"Hostname": "test", "Hostname": "test",
"Image": "ubuntu:16.04", "Image": "ubuntu:16.04",
"Env": [ "Env": [
"container=docker",
"GNS3_MAX_ETHERNET=eth0", "GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network" "GNS3_VOLUMES=/etc/network"
], ],
@ -185,8 +187,10 @@ def test_create_vnc(loop, project, manager):
"Hostname": "test", "Hostname": "test",
"Image": "ubuntu:latest", "Image": "ubuntu:latest",
"Env": [ "Env": [
"container=docker",
"GNS3_MAX_ETHERNET=eth0", "GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network", "GNS3_VOLUMES=/etc/network",
"QT_GRAPHICSSYSTEM=native",
"DISPLAY=:42" "DISPLAY=:42"
], ],
"Entrypoint": ["/gns3/init.sh"], "Entrypoint": ["/gns3/init.sh"],
@ -229,6 +233,7 @@ def test_create_start_cmd(loop, project, manager):
"Hostname": "test", "Hostname": "test",
"Image": "ubuntu:latest", "Image": "ubuntu:latest",
"Env": [ "Env": [
"container=docker",
"GNS3_MAX_ETHERNET=eth0", "GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network" "GNS3_VOLUMES=/etc/network"
] ]
@ -261,6 +266,7 @@ def test_create_environment(loop, project, manager):
"Privileged": True "Privileged": True
}, },
"Env": [ "Env": [
"container=docker",
"GNS3_MAX_ETHERNET=eth0", "GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network", "GNS3_VOLUMES=/etc/network",
"YES=1", "YES=1",
@ -320,6 +326,7 @@ def test_create_image_not_available(loop, project, manager):
"Hostname": "test", "Hostname": "test",
"Image": "ubuntu:latest", "Image": "ubuntu:latest",
"Env": [ "Env": [
"container=docker",
"GNS3_MAX_ETHERNET=eth0", "GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network" "GNS3_VOLUMES=/etc/network"
], ],
@ -540,6 +547,7 @@ def test_update(loop, vm):
"Hostname": "test", "Hostname": "test",
"Image": "ubuntu:latest", "Image": "ubuntu:latest",
"Env": [ "Env": [
"container=docker",
"GNS3_MAX_ETHERNET=eth0", "GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network" "GNS3_VOLUMES=/etc/network"
], ],
@ -608,6 +616,7 @@ def test_update_running(loop, vm):
"Hostname": "test", "Hostname": "test",
"Image": "ubuntu:latest", "Image": "ubuntu:latest",
"Env": [ "Env": [
"container=docker",
"GNS3_MAX_ETHERNET=eth0", "GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network" "GNS3_VOLUMES=/etc/network"
], ],
@ -904,7 +913,7 @@ def test_start_aux(vm, loop):
with asyncio_patch("asyncio.subprocess.create_subprocess_exec", return_value=MagicMock()) as mock_exec: with asyncio_patch("asyncio.subprocess.create_subprocess_exec", return_value=MagicMock()) as mock_exec:
loop.run_until_complete(asyncio.async(vm._start_aux())) loop.run_until_complete(asyncio.async(vm._start_aux()))
mock_exec.assert_called_with('docker', 'exec', '-i', 'e90e34656842', '/gns3/bin/busybox', 'script', '-qfc', '/gns3/bin/busybox sh', '/dev/null', stderr=asyncio.subprocess.STDOUT, stdin=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE) mock_exec.assert_called_with('docker', 'exec', '-i', 'e90e34656842', '/gns3/bin/busybox', 'script', '-qfc', 'while true; do /gns3/bin/busybox sh; done', '/dev/null', stderr=asyncio.subprocess.STDOUT, stdin=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE)
def test_create_network_interfaces(vm): def test_create_network_interfaces(vm):