]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
pybind/ceph_argparse.py:'timeout' must in kwargs when call run_in_thread
authoryangDL <455619311@qq.com>
Thu, 26 Apr 2018 06:53:08 +0000 (14:53 +0800)
committeryangdeliu <yangdeliu@szsandstone.com>
Thu, 26 Apr 2018 09:53:12 +0000 (17:53 +0800)
timeout is ignored by C API, but is useful in python threads.
Function "run_in_thread" get "timeout" from kwargs,but other functions passing
"timeout" in args, so "timeout" is 0 forever in run_in_thread.
It will be polling forever when cluster unhealthy until recv signal like ctrl+c or cluster become healthy.
So pass 'timeout' like 'timeout=timeout'

Signed-off-by: yangdeliu <yangdeliu@szsandstone.com>
src/pybind/ceph_argparse.py

index 858c689307fa04f39fe31147bc0e95097ff4003a..5e10447df3ccdd2b6370e123a09b9eb855766077 100644 (file)
@@ -1261,11 +1261,11 @@ def send_command(cluster, target=('mon', ''), cmd=None, inbuf=b'', timeout=0,
                 print('submit {0} to osd.{1}'.format(cmd, osdid),
                       file=sys.stderr)
             ret, outbuf, outs = run_in_thread(
-                cluster.osd_command, osdid, cmd, inbuf, timeout)
+                cluster.osd_command, osdid, cmd, inbuf, timeout=timeout)
 
         elif target[0] == 'mgr':
             ret, outbuf, outs = run_in_thread(
-                cluster.mgr_command, cmd, inbuf, timeout)
+                cluster.mgr_command, cmd, inbuf, timeout=timeout)
 
         elif target[0] == 'pg':
             pgid = target[1]
@@ -1281,7 +1281,7 @@ def send_command(cluster, target=('mon', ''), cmd=None, inbuf=b'', timeout=0,
                 print('submit {0} for pgid {1}'.format(cmd, pgid),
                       file=sys.stderr)
             ret, outbuf, outs = run_in_thread(
-                cluster.pg_command, pgid, cmd, inbuf, timeout)
+                cluster.pg_command, pgid, cmd, inbuf, timeout=timeout)
 
         elif target[0] == 'mon':
             if verbose:
@@ -1289,10 +1289,10 @@ def send_command(cluster, target=('mon', ''), cmd=None, inbuf=b'', timeout=0,
                       file=sys.stderr)
             if len(target) < 2 or target[1] == '':
                 ret, outbuf, outs = run_in_thread(
-                    cluster.mon_command, cmd, inbuf, timeout)
+                    cluster.mon_command, cmd, inbuf, timeout=timeout)
             else:
                 ret, outbuf, outs = run_in_thread(
-                    cluster.mon_command, cmd, inbuf, timeouttarget[1])
+                    cluster.mon_command, cmd, inbuf, timeout=timeout, target=target[1])
         elif target[0] == 'mds':
             mds_spec = target[1]