1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #include "librbd/image/CreateRequest.h"
5 #include "common/dout.h"
6 #include "common/errno.h"
7 #include "cls/rbd/cls_rbd_client.h"
8 #include "include/assert.h"
9 #include "librbd/Utils.h"
10 #include "common/ceph_context.h"
11 #include "librbd/Journal.h"
12 #include "librbd/MirroringWatcher.h"
13 #include "librbd/journal/CreateRequest.h"
14 #include "librbd/journal/RemoveRequest.h"
15 #include "librbd/mirror/EnableRequest.h"
16 #include "librbd/io/AioCompletion.h"
17 #include "journal/Journaler.h"
19 #define dout_subsys ceph_subsys_rbd
21 #define dout_prefix *_dout << "librbd::image::CreateRequest: " << __func__ \
27 using util::create_rados_callback;
28 using util::create_context_callback;
32 int validate_features(CephContext *cct, uint64_t features,
33 bool force_non_primary) {
34 if (features & ~RBD_FEATURES_ALL) {
35 lderr(cct) << "librbd does not support requested features." << dendl;
38 if ((features & RBD_FEATURE_FAST_DIFF) != 0 &&
39 (features & RBD_FEATURE_OBJECT_MAP) == 0) {
40 lderr(cct) << "cannot use fast diff without object map" << dendl;
43 if ((features & RBD_FEATURE_OBJECT_MAP) != 0 &&
44 (features & RBD_FEATURE_EXCLUSIVE_LOCK) == 0) {
45 lderr(cct) << "cannot use object map without exclusive lock" << dendl;
48 if ((features & RBD_FEATURE_JOURNALING) != 0) {
49 if ((features & RBD_FEATURE_EXCLUSIVE_LOCK) == 0) {
50 lderr(cct) << "cannot use journaling without exclusive lock" << dendl;
53 } else if (force_non_primary) {
60 int validate_striping(CephContext *cct, uint8_t order, uint64_t stripe_unit,
61 uint64_t stripe_count) {
62 if ((stripe_unit && !stripe_count) ||
63 (!stripe_unit && stripe_count)) {
64 lderr(cct) << "must specify both (or neither) of stripe-unit and "
65 << "stripe-count" << dendl;
67 } else if (stripe_unit || stripe_count) {
68 if ((1ull << order) % stripe_unit || stripe_unit > (1ull << order)) {
69 lderr(cct) << "stripe unit is not a factor of the object size" << dendl;
76 int validate_data_pool(CephContext *cct, IoCtx &io_ctx, uint64_t features,
77 const std::string &data_pool, int64_t *data_pool_id) {
78 if ((features & RBD_FEATURE_DATA_POOL) == 0) {
82 librados::Rados rados(io_ctx);
83 librados::IoCtx data_io_ctx;
84 int r = rados.ioctx_create(data_pool.c_str(), data_io_ctx);
86 lderr(cct) << "data pool " << data_pool << " does not exist" << dendl;
90 *data_pool_id = data_io_ctx.get_id();
95 bool validate_layout(CephContext *cct, uint64_t size, file_layout_t &layout) {
96 if (!librbd::ObjectMap<>::is_compatible(layout, size)) {
97 lderr(cct) << "image size not compatible with object map" << dendl;
104 int get_image_option(const ImageOptions &image_options, int option,
106 uint64_t large_value;
107 int r = image_options.get(option, &large_value);
111 *value = static_cast<uint8_t>(large_value);
115 } // anonymous namespace
118 int CreateRequest<I>::validate_order(CephContext *cct, uint8_t order) {
119 if (order > 25 || order < 12) {
120 lderr(cct) << "order must be in the range [12, 25]" << dendl;
127 #define dout_prefix *_dout << "librbd::image::CreateRequest: " << this << " " \
131 CreateRequest<I>::CreateRequest(IoCtx &ioctx, const std::string &image_name,
132 const std::string &image_id, uint64_t size,
133 const ImageOptions &image_options,
134 const std::string &non_primary_global_image_id,
135 const std::string &primary_mirror_uuid,
136 bool skip_mirror_enable,
137 ContextWQ *op_work_queue, Context *on_finish)
138 : m_ioctx(ioctx), m_image_name(image_name), m_image_id(image_id),
139 m_size(size), m_non_primary_global_image_id(non_primary_global_image_id),
140 m_primary_mirror_uuid(primary_mirror_uuid),
141 m_skip_mirror_enable(skip_mirror_enable),
142 m_op_work_queue(op_work_queue), m_on_finish(on_finish) {
143 m_cct = reinterpret_cast<CephContext *>(m_ioctx.cct());
145 m_id_obj = util::id_obj_name(m_image_name);
146 m_header_obj = util::header_name(m_image_id);
147 m_objmap_name = ObjectMap<>::object_map_name(m_image_id, CEPH_NOSNAP);
149 if (image_options.get(RBD_IMAGE_OPTION_FEATURES, &m_features) != 0) {
150 m_features = util::get_rbd_default_features(m_cct);
151 m_negotiate_features = true;
154 uint64_t features_clear = 0;
155 uint64_t features_set = 0;
156 image_options.get(RBD_IMAGE_OPTION_FEATURES_CLEAR, &features_clear);
157 image_options.get(RBD_IMAGE_OPTION_FEATURES_SET, &features_set);
159 uint64_t features_conflict = features_clear & features_set;
160 features_clear &= ~features_conflict;
161 features_set &= ~features_conflict;
162 m_features |= features_set;
163 m_features &= ~features_clear;
165 if (image_options.get(RBD_IMAGE_OPTION_STRIPE_UNIT, &m_stripe_unit) != 0 ||
166 m_stripe_unit == 0) {
167 m_stripe_unit = m_cct->_conf->get_val<uint64_t>("rbd_default_stripe_unit");
169 if (image_options.get(RBD_IMAGE_OPTION_STRIPE_COUNT, &m_stripe_count) != 0 ||
170 m_stripe_count == 0) {
171 m_stripe_count = m_cct->_conf->get_val<uint64_t>("rbd_default_stripe_count");
173 if (get_image_option(image_options, RBD_IMAGE_OPTION_ORDER, &m_order) != 0 ||
175 m_order = m_cct->_conf->get_val<int64_t>("rbd_default_order");
177 if (get_image_option(image_options, RBD_IMAGE_OPTION_JOURNAL_ORDER,
178 &m_journal_order) != 0) {
179 m_journal_order = m_cct->_conf->get_val<uint64_t>("rbd_journal_order");
181 if (get_image_option(image_options, RBD_IMAGE_OPTION_JOURNAL_SPLAY_WIDTH,
182 &m_journal_splay_width) != 0) {
183 m_journal_splay_width = m_cct->_conf->get_val<uint64_t>("rbd_journal_splay_width");
185 if (image_options.get(RBD_IMAGE_OPTION_JOURNAL_POOL, &m_journal_pool) != 0) {
186 m_journal_pool = m_cct->_conf->get_val<std::string>("rbd_journal_pool");
188 if (image_options.get(RBD_IMAGE_OPTION_DATA_POOL, &m_data_pool) != 0) {
189 m_data_pool = m_cct->_conf->get_val<std::string>("rbd_default_data_pool");
192 m_layout.object_size = 1ull << m_order;
193 if (m_stripe_unit == 0 || m_stripe_count == 0) {
194 m_layout.stripe_unit = m_layout.object_size;
195 m_layout.stripe_count = 1;
197 m_layout.stripe_unit = m_stripe_unit;
198 m_layout.stripe_count = m_stripe_count;
201 m_force_non_primary = !non_primary_global_image_id.empty();
203 if (!m_data_pool.empty() && m_data_pool != ioctx.get_pool_name()) {
204 m_features |= RBD_FEATURE_DATA_POOL;
207 m_features &= ~RBD_FEATURE_DATA_POOL;
210 if ((m_stripe_unit != 0 && m_stripe_unit != (1ULL << m_order)) ||
211 (m_stripe_count != 0 && m_stripe_count != 1)) {
212 m_features |= RBD_FEATURE_STRIPINGV2;
214 m_features &= ~RBD_FEATURE_STRIPINGV2;
217 ldout(m_cct, 20) << "name=" << m_image_name << ", "
218 << "id=" << m_image_id << ", "
219 << "size=" << m_size << ", "
220 << "features=" << m_features << ", "
221 << "order=" << (uint64_t)m_order << ", "
222 << "stripe_unit=" << m_stripe_unit << ", "
223 << "stripe_count=" << m_stripe_count << ", "
224 << "journal_order=" << (uint64_t)m_journal_order << ", "
225 << "journal_splay_width="
226 << (uint64_t)m_journal_splay_width << ", "
227 << "journal_pool=" << m_journal_pool << ", "
228 << "data_pool=" << m_data_pool << dendl;
232 void CreateRequest<I>::send() {
233 ldout(m_cct, 20) << dendl;
235 int r = validate_features(m_cct, m_features, m_force_non_primary);
241 r = validate_order(m_cct, m_order);
247 r = validate_striping(m_cct, m_order, m_stripe_unit, m_stripe_count);
253 r = validate_data_pool(m_cct, m_ioctx, m_features, m_data_pool,
260 if (((m_features & RBD_FEATURE_OBJECT_MAP) != 0) &&
261 (!validate_layout(m_cct, m_size, m_layout))) {
270 void CreateRequest<I>::validate_pool() {
271 if (!m_cct->_conf->get_val<bool>("rbd_validate_pool")) {
276 ldout(m_cct, 20) << dendl;
278 using klass = CreateRequest<I>;
279 librados::AioCompletion *comp =
280 create_rados_callback<klass, &klass::handle_validate_pool>(this);
282 librados::ObjectReadOperation op;
283 op.stat(NULL, NULL, NULL);
286 int r = m_ioctx.aio_operate(RBD_DIRECTORY, comp, &op, &m_outbl);
292 void CreateRequest<I>::handle_validate_pool(int r) {
293 ldout(m_cct, 20) << "r=" << r << dendl;
296 validate_overwrite();
298 } else if ((r < 0) && (r != -ENOENT)) {
299 lderr(m_cct) << "failed to stat RBD directory: " << cpp_strerror(r)
305 // allocate a self-managed snapshot id if this a new pool to force
306 // self-managed snapshot mode
307 // This call is executed just once per (fresh) pool, hence we do not
308 // try hard to make it asynchronous (and it's pretty safe not to cause
312 r = m_ioctx.selfmanaged_snap_create(&snap_id);
314 lderr(m_cct) << "pool not configured for self-managed RBD snapshot support"
319 lderr(m_cct) << "failed to allocate self-managed snapshot: "
320 << cpp_strerror(r) << dendl;
325 r = m_ioctx.selfmanaged_snap_remove(snap_id);
327 // we've already switched to self-managed snapshots -- no need to
328 // error out in case of failure here.
329 ldout(m_cct, 10) << "failed to release self-managed snapshot " << snap_id
330 << ": " << cpp_strerror(r) << dendl;
333 validate_overwrite();
336 template <typename I>
337 void CreateRequest<I>::validate_overwrite() {
338 ldout(m_cct, 20) << dendl;
340 m_data_io_ctx = m_ioctx;
341 if (m_data_pool_id != -1) {
342 librados::Rados rados(m_ioctx);
343 int r = rados.ioctx_create2(m_data_pool_id, m_data_io_ctx);
345 lderr(m_cct) << "data pool " << m_data_pool << " does not exist" << dendl;
351 using klass = CreateRequest<I>;
352 librados::AioCompletion *comp =
353 create_rados_callback<klass, &klass::handle_validate_overwrite>(this);
355 librados::ObjectReadOperation op;
356 op.read(0, 0, nullptr, nullptr);
359 int r = m_data_io_ctx.aio_operate(RBD_INFO, comp, &op, &m_outbl);
364 template <typename I>
365 void CreateRequest<I>::handle_validate_overwrite(int r) {
366 ldout(m_cct, 20) << "r=" << r << dendl;
369 bl.append("overwrite validated");
371 if (r == 0 && m_outbl.contents_equal(bl)) {
374 } else if ((r < 0) && (r != -ENOENT)) {
375 lderr(m_cct) << "failed to read RBD info: " << cpp_strerror(r) << dendl;
380 // validate the pool supports overwrites. We cannot use rbd_directory
381 // since the v1 images store the directory as tmap data within the object.
382 ldout(m_cct, 10) << "validating overwrite support" << dendl;
383 bufferlist initial_bl;
384 initial_bl.append("validate");
385 r = m_data_io_ctx.write(RBD_INFO, initial_bl, initial_bl.length(), 0);
387 r = m_data_io_ctx.write(RBD_INFO, bl, bl.length(), 0);
389 if (r == -EOPNOTSUPP) {
390 lderr(m_cct) << "pool missing required overwrite support" << dendl;
394 lderr(m_cct) << "failed to validate overwrite support: " << cpp_strerror(r)
404 void CreateRequest<I>::create_id_object() {
405 ldout(m_cct, 20) << dendl;
407 librados::ObjectWriteOperation op;
409 cls_client::set_id(&op, m_image_id);
411 using klass = CreateRequest<I>;
412 librados::AioCompletion *comp =
413 create_rados_callback<klass, &klass::handle_create_id_object>(this);
414 int r = m_ioctx.aio_operate(m_id_obj, comp, &op);
420 void CreateRequest<I>::handle_create_id_object(int r) {
421 ldout(m_cct, 20) << "r=" << r << dendl;
424 lderr(m_cct) << "error creating RBD id object: " << cpp_strerror(r)
430 add_image_to_directory();
434 void CreateRequest<I>::add_image_to_directory() {
435 ldout(m_cct, 20) << dendl;
437 librados::ObjectWriteOperation op;
438 cls_client::dir_add_image(&op, m_image_name, m_image_id);
440 using klass = CreateRequest<I>;
441 librados::AioCompletion *comp =
442 create_rados_callback<klass, &klass::handle_add_image_to_directory>(this);
443 int r = m_ioctx.aio_operate(RBD_DIRECTORY, comp, &op);
449 void CreateRequest<I>::handle_add_image_to_directory(int r) {
450 ldout(m_cct, 20) << "r=" << r << dendl;
453 lderr(m_cct) << "error adding image to directory: " << cpp_strerror(r)
460 negotiate_features();
464 void CreateRequest<I>::negotiate_features() {
465 if (!m_negotiate_features) {
470 ldout(m_cct, 20) << dendl;
472 librados::ObjectReadOperation op;
473 cls_client::get_all_features_start(&op);
475 using klass = CreateRequest<I>;
476 librados::AioCompletion *comp =
477 create_rados_callback<klass, &klass::handle_negotiate_features>(this);
480 int r = m_ioctx.aio_operate(RBD_DIRECTORY, comp, &op, &m_outbl);
486 void CreateRequest<I>::handle_negotiate_features(int r) {
487 ldout(m_cct, 20) << "r=" << r << dendl;
489 uint64_t all_features;
491 bufferlist::iterator it = m_outbl.begin();
492 r = cls_client::get_all_features_finish(&it, &all_features);
495 ldout(m_cct, 10) << "error retrieving server supported features set: "
496 << cpp_strerror(r) << dendl;
497 } else if ((m_features & all_features) != m_features) {
498 m_features &= all_features;
499 ldout(m_cct, 10) << "limiting default features set to server supported: "
500 << m_features << dendl;
507 void CreateRequest<I>::create_image() {
508 ldout(m_cct, 20) << dendl;
509 assert(m_data_pool.empty() || m_data_pool_id != -1);
512 oss << RBD_DATA_PREFIX;
513 if (m_data_pool_id != -1) {
514 oss << stringify(m_ioctx.get_id()) << ".";
517 if (oss.str().length() > RBD_MAX_BLOCK_NAME_PREFIX_LENGTH) {
518 lderr(m_cct) << "object prefix '" << oss.str() << "' too large" << dendl;
523 librados::ObjectWriteOperation op;
525 cls_client::create_image(&op, m_size, m_order, m_features, oss.str(),
528 using klass = CreateRequest<I>;
529 librados::AioCompletion *comp =
530 create_rados_callback<klass, &klass::handle_create_image>(this);
531 int r = m_ioctx.aio_operate(m_header_obj, comp, &op);
537 void CreateRequest<I>::handle_create_image(int r) {
538 ldout(m_cct, 20) << "r=" << r << dendl;
541 lderr(m_cct) << "error writing header: " << cpp_strerror(r) << dendl;
547 set_stripe_unit_count();
551 void CreateRequest<I>::set_stripe_unit_count() {
552 if ((!m_stripe_unit && !m_stripe_count) ||
553 ((m_stripe_count == 1) && (m_stripe_unit == (1ull << m_order)))) {
558 ldout(m_cct, 20) << dendl;
560 librados::ObjectWriteOperation op;
561 cls_client::set_stripe_unit_count(&op, m_stripe_unit, m_stripe_count);
563 using klass = CreateRequest<I>;
564 librados::AioCompletion *comp =
565 create_rados_callback<klass, &klass::handle_set_stripe_unit_count>(this);
566 int r = m_ioctx.aio_operate(m_header_obj, comp, &op);
572 void CreateRequest<I>::handle_set_stripe_unit_count(int r) {
573 ldout(m_cct, 20) << "r=" << r << dendl;
576 lderr(m_cct) << "error setting stripe unit/count: "
577 << cpp_strerror(r) << dendl;
579 remove_header_object();
587 void CreateRequest<I>::object_map_resize() {
588 if ((m_features & RBD_FEATURE_OBJECT_MAP) == 0) {
593 ldout(m_cct, 20) << dendl;
595 librados::ObjectWriteOperation op;
596 cls_client::object_map_resize(&op, Striper::get_num_objects(m_layout, m_size),
599 using klass = CreateRequest<I>;
600 librados::AioCompletion *comp =
601 create_rados_callback<klass, &klass::handle_object_map_resize>(this);
602 int r = m_ioctx.aio_operate(m_objmap_name, comp, &op);
608 void CreateRequest<I>::handle_object_map_resize(int r) {
609 ldout(m_cct, 20) << "r=" << r << dendl;
612 lderr(m_cct) << "error creating initial object map: "
613 << cpp_strerror(r) << dendl;
616 remove_header_object();
624 void CreateRequest<I>::fetch_mirror_mode() {
625 if ((m_features & RBD_FEATURE_JOURNALING) == 0) {
630 ldout(m_cct, 20) << dendl;
632 librados::ObjectReadOperation op;
633 cls_client::mirror_mode_get_start(&op);
635 using klass = CreateRequest<I>;
636 librados::AioCompletion *comp =
637 create_rados_callback<klass, &klass::handle_fetch_mirror_mode>(this);
639 int r = m_ioctx.aio_operate(RBD_MIRRORING, comp, &op, &m_outbl);
645 void CreateRequest<I>::handle_fetch_mirror_mode(int r) {
646 ldout(m_cct, 20) << "r=" << r << dendl;
648 if ((r < 0) && (r != -ENOENT)) {
649 lderr(m_cct) << "failed to retrieve mirror mode: " << cpp_strerror(r)
657 cls::rbd::MirrorMode mirror_mode_internal = cls::rbd::MIRROR_MODE_DISABLED;
659 bufferlist::iterator it = m_outbl.begin();
660 r = cls_client::mirror_mode_get_finish(&it, &mirror_mode_internal);
662 lderr(m_cct) << "Failed to retrieve mirror mode" << dendl;
670 // TODO: remove redundant code...
671 switch (mirror_mode_internal) {
672 case cls::rbd::MIRROR_MODE_DISABLED:
673 case cls::rbd::MIRROR_MODE_IMAGE:
674 case cls::rbd::MIRROR_MODE_POOL:
675 m_mirror_mode = static_cast<rbd_mirror_mode_t>(mirror_mode_internal);
678 lderr(m_cct) << "Unknown mirror mode ("
679 << static_cast<uint32_t>(mirror_mode_internal) << ")" << dendl;
689 void CreateRequest<I>::journal_create() {
690 ldout(m_cct, 20) << dendl;
692 using klass = CreateRequest<I>;
693 Context *ctx = create_context_callback<klass, &klass::handle_journal_create>(
696 librbd::journal::TagData tag_data;
697 tag_data.mirror_uuid = (m_force_non_primary ? m_primary_mirror_uuid :
698 librbd::Journal<I>::LOCAL_MIRROR_UUID);
700 librbd::journal::CreateRequest<I> *req =
701 librbd::journal::CreateRequest<I>::create(
702 m_ioctx, m_image_id, m_journal_order, m_journal_splay_width,
703 m_journal_pool, cls::journal::Tag::TAG_CLASS_NEW, tag_data,
704 librbd::Journal<I>::IMAGE_CLIENT_ID, m_op_work_queue, ctx);
709 void CreateRequest<I>::handle_journal_create(int r) {
710 ldout(m_cct, 20) << "r=" << r << dendl;
713 lderr(m_cct) << "error creating journal: " << cpp_strerror(r)
721 mirror_image_enable();
725 void CreateRequest<I>::mirror_image_enable() {
726 if (((m_mirror_mode != RBD_MIRROR_MODE_POOL) && !m_force_non_primary) ||
727 m_skip_mirror_enable) {
732 ldout(m_cct, 20) << dendl;
733 auto ctx = create_context_callback<
734 CreateRequest<I>, &CreateRequest<I>::handle_mirror_image_enable>(this);
735 auto req = mirror::EnableRequest<I>::create(m_ioctx, m_image_id,
736 m_non_primary_global_image_id,
737 m_op_work_queue, ctx);
742 void CreateRequest<I>::handle_mirror_image_enable(int r) {
743 ldout(m_cct, 20) << "r=" << r << dendl;
746 lderr(m_cct) << "cannot enable mirroring: " << cpp_strerror(r)
758 void CreateRequest<I>::complete(int r) {
759 ldout(m_cct, 20) << dendl;
762 ldout(m_cct, 20) << "done." << dendl;
765 m_data_io_ctx.close();
766 m_on_finish->complete(r);
772 void CreateRequest<I>::journal_remove() {
773 if ((m_features & RBD_FEATURE_JOURNALING) == 0) {
778 ldout(m_cct, 20) << dendl;
780 using klass = CreateRequest<I>;
781 Context *ctx = create_context_callback<klass, &klass::handle_journal_remove>(
784 librbd::journal::RemoveRequest<I> *req =
785 librbd::journal::RemoveRequest<I>::create(
786 m_ioctx, m_image_id, librbd::Journal<I>::IMAGE_CLIENT_ID, m_op_work_queue,
792 void CreateRequest<I>::handle_journal_remove(int r) {
793 ldout(m_cct, 20) << "r=" << r << dendl;
796 lderr(m_cct) << "error cleaning up journal after creation failed: "
797 << cpp_strerror(r) << dendl;
804 void CreateRequest<I>::remove_object_map() {
805 if ((m_features & RBD_FEATURE_OBJECT_MAP) == 0) {
806 remove_header_object();
810 ldout(m_cct, 20) << dendl;
812 using klass = CreateRequest<I>;
813 librados::AioCompletion *comp =
814 create_rados_callback<klass, &klass::handle_remove_object_map>(this);
815 int r = m_ioctx.aio_remove(m_objmap_name, comp);
821 void CreateRequest<I>::handle_remove_object_map(int r) {
822 ldout(m_cct, 20) << "r=" << r << dendl;
825 lderr(m_cct) << "error cleaning up object map after creation failed: "
826 << cpp_strerror(r) << dendl;
829 remove_header_object();
833 void CreateRequest<I>::remove_header_object() {
834 ldout(m_cct, 20) << dendl;
836 using klass = CreateRequest<I>;
837 librados::AioCompletion *comp =
838 create_rados_callback<klass, &klass::handle_remove_header_object>(this);
839 int r = m_ioctx.aio_remove(m_header_obj, comp);
845 void CreateRequest<I>::handle_remove_header_object(int r) {
846 ldout(m_cct, 20) << "r=" << r << dendl;
849 lderr(m_cct) << "error cleaning up image header after creation failed: "
850 << cpp_strerror(r) << dendl;
857 void CreateRequest<I>::remove_from_dir() {
858 ldout(m_cct, 20) << dendl;
860 librados::ObjectWriteOperation op;
861 cls_client::dir_remove_image(&op, m_image_name, m_image_id);
863 using klass = CreateRequest<I>;
864 librados::AioCompletion *comp =
865 create_rados_callback<klass, &klass::handle_remove_from_dir>(this);
866 int r = m_ioctx.aio_operate(RBD_DIRECTORY, comp, &op);
872 void CreateRequest<I>::handle_remove_from_dir(int r) {
873 ldout(m_cct, 20) << "r=" << r << dendl;
876 lderr(m_cct) << "error cleaning up image from rbd_directory object "
877 << "after creation failed: " << cpp_strerror(r) << dendl;
884 void CreateRequest<I>::remove_id_object() {
885 ldout(m_cct, 20) << dendl;
887 using klass = CreateRequest<I>;
888 librados::AioCompletion *comp =
889 create_rados_callback<klass, &klass::handle_remove_id_object>(this);
890 int r = m_ioctx.aio_remove(m_id_obj, comp);
896 void CreateRequest<I>::handle_remove_id_object(int r) {
897 ldout(m_cct, 20) << "r=" << r << dendl;
900 lderr(m_cct) << "error cleaning up id object after creation failed: "
901 << cpp_strerror(r) << dendl;
910 template class librbd::image::CreateRequest<librbd::ImageCtx>;