mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Different approach to handle no data returned by Dynamips or uBridge hypervisors. Fixes #1289.
This commit is contained in:
parent
a3a0657502
commit
7c14e21f4a
@ -260,6 +260,8 @@ class DynamipsHypervisor:
|
|||||||
# Now retrieve the result
|
# Now retrieve the result
|
||||||
data = []
|
data = []
|
||||||
buf = ''
|
buf = ''
|
||||||
|
retries = 0
|
||||||
|
max_retries = 10
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
@ -276,11 +278,14 @@ class DynamipsHypervisor:
|
|||||||
log.warning("Connection reset received while reading Dynamips response: {}".format(e))
|
log.warning("Connection reset received while reading Dynamips response: {}".format(e))
|
||||||
continue
|
continue
|
||||||
if not chunk:
|
if not chunk:
|
||||||
if self.is_running():
|
if retries > max_retries:
|
||||||
log.warning("No data returned from {host}:{port}".format(host=self._host, port=self._port))
|
raise DynamipsError("No data returned from {host}:{port}, Dynamips process running: {run}"
|
||||||
|
.format(host=self._host, port=self._port, run=self.is_running()))
|
||||||
|
else:
|
||||||
|
retries += 1
|
||||||
|
yield from asyncio.sleep(0.1)
|
||||||
continue
|
continue
|
||||||
raise DynamipsError("No data returned from {host}:{port}, Dynamips process running: {run}"
|
retries = 0
|
||||||
.format(host=self._host, port=self._port, run=self.is_running()))
|
|
||||||
buf += chunk.decode("utf-8", errors="ignore")
|
buf += chunk.decode("utf-8", errors="ignore")
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise DynamipsError("Could not read response for '{command}' from {host}:{port}: {error}, process running: {run}"
|
raise DynamipsError("Could not read response for '{command}' from {host}:{port}: {error}, process running: {run}"
|
||||||
|
Loading…
Reference in New Issue
Block a user