diff options
author | Sage Weil <sage@inktank.com> | 2013-07-08 21:12:49 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-07-16 16:58:13 -0700 |
commit | f2fa01e22db4463744c441dd0e37f79bda130fc9 (patch) | |
tree | d2c784ffb69851ac7110e4d767859da323662943 | |
parent | d45429b81ab9817284d6dca98077cb77b5e8280f (diff) | |
download | ceph-f2fa01e22db4463744c441dd0e37f79bda130fc9.tar.gz |
ceph: send successful commands twice with CEPH_CLI_TEST_DUP_COMMAND
Monitor commands need to be idempotent. This helps us test this by
simply issuing any successful command a second time so that we notice
when a dup submission fails.
Signed-off-by: Sage Weil <sage@inktank.com>
-rwxr-xr-x | src/ceph.in | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ceph.in b/src/ceph.in index b5b6f4b0d38..0f7179b8aed 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -695,6 +695,15 @@ def main(): ret, outbuf, outs = new_style_command(parsed_args, childargs, target, sigdict, inbuf, verbose) + # debug tool: send any successful command *again* to + # verify that it is idempotent. + if not ret and 'CEPH_CLI_TEST_DUP_COMMAND' in os.environ: + ret, outbuf, outs = new_style_command(parsed_args, childargs, target, + sigdict, inbuf, verbose) + if ret < 0: + ret = -ret + print >> sys.stderr, prefix + 'Second attempt of previously successful command failed with {0}: {1}'.format(errno.errorcode[ret], outs) + if ret < 0: ret = -ret print >> sys.stderr, prefix + 'Error {0}: {1}'.format(errno.errorcode[ret], outs) |