summaryrefslogtreecommitdiff
path: root/python/ovs/reconnect.py
diff options
context:
space:
mode:
authorAndrew Evans <aevans@nicira.com>2011-03-15 14:42:49 -0700
committerAndrew Evans <aevans@nicira.com>2011-03-15 14:42:49 -0700
commit34d84bb951caa50831f0a2f553b41d9da8ceb128 (patch)
tree4150e1ad26775b9ac81db62c6e733dfa82bd5e2b /python/ovs/reconnect.py
parente8fe30269ae37c485495f2c0b086fefe95ae1e50 (diff)
downloadopenvswitch-34d84bb951caa50831f0a2f553b41d9da8ceb128.tar.gz
reconnect.py: Fix Python 2.4 compatibility break.
Commit 5eda645e36 (ovsdb-server: Report time since last connect and disconnect for each manager.) used a conditional expression in reconnect.py. That syntax is only supported in Python 2.5 and later. XenServer 5.6 is based on RHEL 5, which uses Python 2.4.3, so various OVS scripts on XenServer fail with Python tracebacks. Reported-by: Cedric Hobbs <cedric@nicira.com>
Diffstat (limited to 'python/ovs/reconnect.py')
-rw-r--r--python/ovs/reconnect.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/python/ovs/reconnect.py b/python/ovs/reconnect.py
index 49c7a094c..5fc96bc87 100644
--- a/python/ovs/reconnect.py
+++ b/python/ovs/reconnect.py
@@ -558,8 +558,9 @@ class Reconnect(object):
stats.is_connected = self.is_connected()
stats.msec_since_connect = self.get_last_connect_elapsed(now)
stats.msec_since_disconnect = self.get_last_disconnect_elapsed(now)
- stats.total_connected_duration = self.total_connected_duration + \
- (self.get_last_connect_elapsed(now) if self.is_connected() else 0)
+ stats.total_connected_duration = self.total_connected_duration
+ if self.is_connected():
+ stats.total_connected_duration += self.get_last_connect_elapsed(now)
stats.n_attempted_connections = self.n_attempted_connections
stats.n_successful_connections = self.n_successful_connections
stats.state = self.state.name