From 819290e5cfefd9ffe2720529bae2924c4b91c07d Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 27 Feb 2019 14:13:16 -0500 Subject: [PATCH] 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 --- src/librbd/api/Pool.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 -- 2.39.5