From 1beae954432d13e4f3077a0c102a4511054c3579 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Mon, 21 Nov 2016 09:58:42 +0100 Subject: [PATCH] Multiple improvements around starting the GNS3 VM * avoid concurrent start * proper catching of the TimeOut error Ref #754 --- gns3server/controller/compute.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gns3server/controller/compute.py b/gns3server/controller/compute.py index af984987..d40f5640 100644 --- a/gns3server/controller/compute.py +++ b/gns3server/controller/compute.py @@ -27,6 +27,7 @@ import io from ..utils import parse_version from ..utils.images import scan_for_images, md5sum +from ..utils.asyncio import locked_coroutine from ..controller.controller_error import ControllerError from ..config import Config from ..version import __version__ @@ -354,7 +355,7 @@ class Compute: response = yield from self._run_http_query(method, path, data=data, **kwargs) return response - @asyncio.coroutine + @locked_coroutine def connect(self): """ Check if remote server is accessible @@ -469,6 +470,8 @@ class Compute: data = json.dumps(data) try: response = yield from self._session().request(method, url, headers=headers, data=data, auth=self._auth, chunked=chunked, timeout=timeout) + except asyncio.TimeoutError as e: + raise ComputeError("Timeout error when connecting to {}".format(url)) except (aiohttp.errors.ClientOSError, aiohttp.errors.ClientRequestError, aiohttp.ClientResponseError) as e: raise ComputeError(str(e)) body = yield from response.read()