]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph: send successful commands twice with CEPH_CLI_TEST_DUP_COMMAND
authorSage Weil <sage@inktank.com>
Tue, 9 Jul 2013 04:12:49 +0000 (21:12 -0700)
committerSage Weil <sage@inktank.com>
Tue, 16 Jul 2013 23:58:13 +0000 (16:58 -0700)
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>
src/ceph.in

index b5b6f4b0d384460a10ac9f0d1470fd75450b683e..0f7179b8aedbf1a3a715e6b6bb48e0b495b88f45 100755 (executable)
@@ -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)