mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-18 07:23:47 +02:00
Fixes connect call failed for Dynamips hypervisor #78.
This commit is contained in:
parent
7223005acd
commit
518b037d54
@ -73,12 +73,20 @@ class DynamipsHypervisor:
|
|||||||
else:
|
else:
|
||||||
host = self._host
|
host = self._host
|
||||||
|
|
||||||
try:
|
tries = 3
|
||||||
self._reader, self._writer = yield from asyncio.wait_for(asyncio.open_connection(host, self._port), timeout=self._timeout)
|
while tries > 0:
|
||||||
except OSError as e:
|
try:
|
||||||
raise DynamipsError("Could not connect to hypervisor {}:{} {}".format(host, self._port, e))
|
self._reader, self._writer = yield from asyncio.wait_for(asyncio.open_connection(host, self._port), timeout=self._timeout)
|
||||||
except asyncio.TimeoutError:
|
break
|
||||||
raise DynamipsError("Timeout error while connecting to hypervisor {}:{}".format(host, self._port))
|
except OSError as e:
|
||||||
|
if tries:
|
||||||
|
tries -= 1
|
||||||
|
log.warn("Could not connect to hypervisor {}:{} {}, retrying...".format(host, self._port, e))
|
||||||
|
yield from asyncio.sleep(0.1)
|
||||||
|
continue
|
||||||
|
raise DynamipsError("Could not connect to hypervisor {}:{} {}".format(host, self._port, e))
|
||||||
|
except asyncio.TimeoutError:
|
||||||
|
raise DynamipsError("Timeout error while connecting to hypervisor {}:{}".format(host, self._port))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
version = yield from self.send("hypervisor version")
|
version = yield from self.send("hypervisor version")
|
||||||
|
Loading…
Reference in New Issue
Block a user