]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Added timeout flag to ovs-vsctl to avoid infinte waiting
authorGhe Rivero <ghe@debian.org>
Thu, 17 Nov 2011 08:21:09 +0000 (09:21 +0100)
committerGhe Rivero <ghe@debian.org>
Tue, 29 Nov 2011 17:21:14 +0000 (18:21 +0100)
Fixes bug 890180

Change-Id: Iba76359d5ee4f625b6a7007b318cf0eb5f1119da

quantum/plugins/openvswitch/agent/ovs_quantum_agent.py

index 398b8b9947c479d1f63d101edbbcd6cb79f2cebb..afeb6b404645e07dcbf4997e558590b1845c713f 100755 (executable)
@@ -24,6 +24,7 @@ import MySQLdb
 import os
 import sys
 import time
+import signal
 
 from optparse import OptionParser
 from subprocess import *
@@ -51,10 +52,14 @@ class OVSBridge:
 
     def run_cmd(self, args):
         # LOG.debug("## running command: " + " ".join(args))
-        return Popen(args, stdout=PIPE).communicate()[0]
+        p = Popen(args, stdout=PIPE)
+        retval = p.communicate()[0]
+        if p.returncode == -(signal.SIGALRM):
+            LOG.debug("## timeout running command: " + " ".join(args))
+        return retval
 
     def run_vsctl(self, args):
-        full_args = ["ovs-vsctl"] + args
+        full_args = ["ovs-vsctl", "--timeout=2"] + args
         return self.run_cmd(full_args)
 
     def reset_bridge(self):