]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
librbd: pool_init API now validates the pool
authorJason Dillaman <dillaman@redhat.com>
Wed, 27 Feb 2019 19:13:16 +0000 (14:13 -0500)
committerJason Dillaman <dillaman@redhat.com>
Fri, 1 Mar 2019 13:27:27 +0000 (08:27 -0500)
This offloads the validation process from the image creation
state machine under normal conditions.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/api/Pool.cc

index f3dd357faa255c8608d87a7c2abaf1a24e04d87e..0970b92f9c8c6f14ebfd9f6776c6118b215d2fcf 100644 (file)
@@ -8,10 +8,12 @@
 #include "common/Throttle.h"
 #include "cls/rbd/cls_rbd_client.h"
 #include "osd/osd_types.h"
+#include "librbd/ImageCtx.h"
 #include "librbd/Utils.h"
 #include "librbd/api/Config.h"
 #include "librbd/api/Image.h"
 #include "librbd/api/Trash.h"
+#include "librbd/image/ValidatePoolRequest.h"
 
 #define dout_subsys ceph_subsys_rbd
 
@@ -242,9 +244,15 @@ int Pool<I>::init(librados::IoCtx& io_ctx, bool force) {
     return r;
   }
 
-  // TODO configure self-managed snapshots (and other one-time pool checks)
+  ThreadPool *thread_pool;
+  ContextWQ *op_work_queue;
+  ImageCtx::get_thread_pool_instance(cct, &thread_pool, &op_work_queue);
 
-  return 0;
+  C_SaferCond ctx;
+  auto req = image::ValidatePoolRequest<I>::create(io_ctx, op_work_queue, &ctx);
+  req->send();
+
+  return ctx.wait();
 }
 
 template <typename I>