Skip to content

Commit

Permalink
Merge pull request xapi-project#1522 from mcclurmc/ca116369-perfmon
Browse files Browse the repository at this point in the history
CA-116369: Fix compatibility problem with Python 2.6
  • Loading branch information
Jon Ludlam committed Oct 30, 2013
2 parents 33b26a7 + 0ed8a8f commit fc961fa
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions scripts/perfmon
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,15 @@ def main():
if host_mon:
host_mon.process_rrd_updates(rrd_updates, session)

except socket.error, e:
if e.args[0] == 111:
# "Connection refused" - this happens when we try to restart session and *that* fails
time.sleep(2)
pass

log_err("caught socket.error: (%s) - restarting XAPI session" % " ".join([str(x) for x in e.args]))
restart_session = True

except IOError, e:
if e.args[0] == 'http error' and e.args[1] in (401, 500):
# Error getting rrd_updates: 401=Unauthorised, 500=Internal - start new session
Expand All @@ -1019,14 +1028,6 @@ def main():
log_err("caught IOError: (%s) - restarting XAPI session" % " ".join([str(x) for x in e.args]))
restart_session = True

except socket.error, e:
if e.args[0] == 111:
# "Connection refused" - this happens when we try to restart session and *that* fails
pass

log_err("caught socket.error: (%s) - restarting XAPI session" % " ".join([str(x) for x in e.args]))
restart_session = True

runs += 1
if maxruns is not None and runs >= maxruns:
break
Expand Down

0 comments on commit fc961fa

Please sign in to comment.