]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados_test_stub: added IoCtx::write_full implementation
authorJason Dillaman <dillaman@redhat.com>
Sat, 7 Feb 2015 14:57:36 +0000 (09:57 -0500)
committerJosh Durgin <jdurgin@redhat.com>
Mon, 16 Feb 2015 22:27:25 +0000 (14:27 -0800)
Mapped IoCtx::write_full to existing test method used by the
ObjectWriteOperation::write_full API method. Also added missing
cls_log implementation for debugging.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/test/librados_test_stub/LibradosTestStub.cc

index fc8b80cf9ac76780ec3372e890fbae74cd5d5380..f9cf32bb0797f62a7a00be9b6354ddea567f9a9f 100644 (file)
@@ -5,6 +5,7 @@
 #include "common/ceph_argparse.h"
 #include "common/common_init.h"
 #include "common/config.h"
+#include "common/debug.h"
 #include "common/snap_types.h"
 #include "global/global_context.h"
 #include "librados/AioCompletionImpl.h"
@@ -17,6 +18,9 @@
 #include <deque>
 #include <list>
 #include <vector>
+#include "include/assert.h"
+
+#define dout_subsys ceph_subsys_rados
 
 static librados::TestClassHandler *get_class_handler() {
   static librados::TestClassHandler *s_class_handler = NULL;
@@ -524,6 +528,11 @@ int IoCtx::write(const std::string& oid, bufferlist& bl, size_t len,
   return ctx->write(oid, bl, len, off);
 }
 
+int IoCtx::write_full(const std::string& oid, bufferlist& bl) {
+  TestIoCtxImpl *ctx = reinterpret_cast<TestIoCtxImpl*>(io_ctx_impl);
+  return ctx->write_full(oid, bl);
+}
+
 static int save_operation_result(int result, int *pval) {
   if (pval != NULL) {
     *pval = result;
@@ -956,6 +965,19 @@ int cls_cxx_write_full(cls_method_context_t hctx, bufferlist *inbl) {
 }
 
 int cls_log(int level, const char *format, ...) {
+  int size = 256;
+  va_list ap;
+  while (1) {
+    char buf[size];
+    va_start(ap, format);
+    int n = vsnprintf(buf, size, format, ap);
+    va_end(ap);
+    if ((n > -1 && n < size) || size > 8196) {
+      dout(level) << buf << dendl;
+      return n;
+    }
+    size *= 2;
+  }
   return 0;
 }