1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-24 17:28:08 +00:00

Avoid _fix_permissions() to be called twice when stopping Docker VM. Ref #1428

This commit is contained in:
grossmj 2018-11-26 15:53:24 +07:00
parent a3044ede77
commit c0a0a13bdd

View File

@ -90,6 +90,7 @@ class DockerVM(BaseNode):
self._console_http_port = console_http_port self._console_http_port = console_http_port
self._console_websocket = None self._console_websocket = None
self._extra_hosts = extra_hosts self._extra_hosts = extra_hosts
self._permissions_fixed = False
self._volumes = [] self._volumes = []
# Keep a list of created bridge # Keep a list of created bridge
@ -447,6 +448,7 @@ class DockerVM(BaseNode):
if self.allocate_aux: if self.allocate_aux:
yield from self._start_aux() yield from self._start_aux()
self._permissions_fixed = False
self.status = "started" self.status = "started"
log.info("Docker container '{name}' [{image}] started listen for {console_type} on {console}".format(name=self._name, log.info("Docker container '{name}' [{image}] started listen for {console_type} on {console}".format(name=self._name,
image=self._image, image=self._image,
@ -511,6 +513,7 @@ class DockerVM(BaseNode):
except OSError as e: except OSError as e:
raise DockerError("Could not fix permissions for {}: {}".format(volume, e)) raise DockerError("Could not fix permissions for {}: {}".format(volume, e))
yield from process.wait() yield from process.wait()
self._permissions_fixed = True
@asyncio.coroutine @asyncio.coroutine
def _start_vnc(self): def _start_vnc(self):
@ -697,7 +700,7 @@ class DockerVM(BaseNode):
if state == "paused": if state == "paused":
yield from self.unpause() yield from self.unpause()
if state == "running": if not self._permissions_fixed:
yield from self._fix_permissions() yield from self._fix_permissions()
state = yield from self._get_container_state() state = yield from self._get_container_state()