From: Jason Dillaman Date: Wed, 27 Feb 2019 19:13:16 +0000 (-0500) Subject: librbd: pool_init API now validates the pool X-Git-Tag: v14.1.1~73^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=819290e5cfefd9ffe2720529bae2924c4b91c07d;p=ceph-ci.git librbd: pool_init API now validates the pool This offloads the validation process from the image creation state machine under normal conditions. Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/api/Pool.cc b/src/librbd/api/Pool.cc index f3dd357faa2..0970b92f9c8 100644 --- a/src/librbd/api/Pool.cc +++ b/src/librbd/api/Pool.cc @@ -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::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::create(io_ctx, op_work_queue, &ctx); + req->send(); + + return ctx.wait(); } template