Skip to content

Commit

Permalink
Multiple improvements around starting the GNS3 VM
Browse files Browse the repository at this point in the history
* avoid concurrent start
* proper catching of the TimeOut error

Ref #754
  • Loading branch information
julien-duponchelle committed Nov 21, 2016
1 parent 40af2a3 commit 1beae95
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gns3server/controller/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

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__
Expand Down Expand Up @@ -354,7 +355,7 @@ def http_query(self, method, path, data=None, **kwargs):
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
Expand Down Expand Up @@ -469,6 +470,8 @@ def send_data(f):
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()
Expand Down

0 comments on commit 1beae95

Please sign in to comment.