]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph: add --connect-timeout option
authorSage Weil <sage@inktank.com>
Tue, 22 Oct 2013 19:22:24 +0000 (12:22 -0700)
committerSage Weil <sage@inktank.com>
Tue, 22 Oct 2013 19:34:53 +0000 (12:34 -0700)
Signed-off-by: Sage Weil <sage@inktank.com>
src/ceph.in

index 1ce9715f8a7a9bf97135754d485067fb0b43888d..ec20198b697f153ae01c678cd464abd4bdf4e2de 100755 (executable)
@@ -161,6 +161,10 @@ def parse_cmdargs(args=None, target=''):
     parser.add_argument('-f', '--format', choices=['json', 'json-pretty',
                         'xml', 'xml-pretty', 'plain'], dest='output_format')
 
+    parser.add_argument('--connect-timeout', dest='cluster_timeout',
+                        type=int,
+                        help='set a timeout for connecting to the cluster')
+
     # returns a Namespace with the parsed args, and a list of all extras
     parsed_args, extras = parser.parse_known_args(args)
 
@@ -577,6 +581,11 @@ def main():
         print >> sys.stderr, '"{0} tell" is deprecated; try "tell {0}.<id>" instead (id can be "*") '.format(childargs[0])
         return 1
 
+
+    timeout = None
+    if parsed_args.cluster_timeout:
+        timeout = parsed_args.cluster_timeout
+
     if parsed_args.help:
         do_basic_help(parser, childargs)
 
@@ -584,7 +593,7 @@ def main():
         print '[Contacting monitor, timeout after %d seconds]' % timeout
 
     try:
-        cluster_handle.connect()
+        cluster_handle.connect(timeout=timeout)
     except KeyboardInterrupt:
         print >> sys.stderr, 'Cluster connection aborted'
         return 1