Skip to content

Commit

Permalink
CA-332801: use slightly longer timeout for testing connectivity
Browse files Browse the repository at this point in the history
If this extends the error case too much we may have to do
connectivity checks in parallel threads.

Signed-off-by: Mark Syms <mark.syms@citrix.com>
  • Loading branch information
MarkSymsCtx committed Dec 12, 2019
1 parent 25481c2 commit b19d091
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,17 +870,19 @@ def _testHost(hostname, port, errstring):
logException('Exception occured getting IP for %s'%hostname)
raise xs_errors.XenError('DNSError')

timeout = 5

sock = socket.socket(sockinfo[0], socket.SOCK_STREAM)
# Only allow the connect to block for up to 2 seconds
sock.settimeout(2)
# Only allow the connect to block for up to timeout seconds
sock.settimeout(timeout)
try:
sock.connect(sockinfo[4])
# Fix for MS storage server bug
sock.send('\n')
sock.close()
except socket.error, reason:
SMlog("_testHost: Connect failed after 2 seconds (%s) - %s" \
% (hostname, reason))
SMlog("_testHost: Connect failed after %d seconds (%s) - %s" \
% (timeout, hostname, reason))
raise xs_errors.XenError(errstring)

def match_scsiID(s, id):
Expand Down

0 comments on commit b19d091

Please sign in to comment.