From: Andrew Evans Date: Tue, 15 Mar 2011 21:42:49 +0000 (-0700) Subject: reconnect.py: Fix Python 2.4 compatibility break. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=34d84bb951caa50831f0a2f553b41d9da8ceb128;p=openvswitch 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 --- diff --git a/python/ovs/reconnect.py b/python/ovs/reconnect.py index 49c7a094..5fc96bc8 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