summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-10-22 12:22:24 -0700
committerSage Weil <sage@inktank.com>2013-10-22 12:34:53 -0700
commit15de2c48a10a495c65cde96aaec21bc739f131e9 (patch)
tree8019c7032fa623d47b10a071af1e689fb14443b8
parente9224755e2152eaf9c45b7420d9ae26b20f4e5c3 (diff)
downloadceph-15de2c48a10a495c65cde96aaec21bc739f131e9.tar.gz
ceph: add --connect-timeout option
Signed-off-by: Sage Weil <sage@inktank.com>
-rwxr-xr-xsrc/ceph.in11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/ceph.in b/src/ceph.in
index 1ce9715f8a7..ec20198b697 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}.<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