Skip to content

Commit

Permalink
CA-320481: use slightly longer timeout for testing connectivity
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkSymsCtx committed Jun 13, 2019
1 parent 7b0952a commit c305da6
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 @@ -863,17 +863,19 @@ def _testHost(hostname, port, errstring):
logException('Exception occured getting IP for %s'%hostname)
raise xs_errors.XenError('DNSError')

timeout = 10

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 c305da6

Please sign in to comment.