From: Sage Weil Date: Tue, 22 Oct 2013 19:22:24 +0000 (-0700) Subject: ceph: add --connect-timeout option X-Git-Tag: v0.72-rc1~23^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=15de2c48a10a495c65cde96aaec21bc739f131e9;p=ceph.git ceph: add --connect-timeout option Signed-off-by: Sage Weil --- diff --git a/src/ceph.in b/src/ceph.in index 1ce9715f8a7a..ec20198b697f 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -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}." 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