1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #include "cls/rbd/cls_rbd_client.h"
5 #include "cls/lock/cls_lock_client.h"
6 #include "include/buffer.h"
7 #include "include/encoding.h"
8 #include "include/rbd_types.h"
9 #include "include/rados/librados.hpp"
10 #include "common/bit_vector.hpp"
15 namespace cls_client
{
17 void create_image(librados::ObjectWriteOperation
*op
, uint64_t size
,
18 uint8_t order
, uint64_t features
,
19 const std::string
&object_prefix
, int64_t data_pool_id
)
25 encode(object_prefix
, bl
);
26 encode(data_pool_id
, bl
);
28 op
->exec("rbd", "create", bl
);
31 int create_image(librados::IoCtx
*ioctx
, const std::string
&oid
,
32 uint64_t size
, uint8_t order
, uint64_t features
,
33 const std::string
&object_prefix
, int64_t data_pool_id
)
35 librados::ObjectWriteOperation op
;
36 create_image(&op
, size
, order
, features
, object_prefix
, data_pool_id
);
38 return ioctx
->operate(oid
, &op
);
41 void get_features_start(librados::ObjectReadOperation
*op
, bool read_only
)
44 encode(static_cast<uint64_t>(CEPH_NOSNAP
), bl
);
45 encode(read_only
, bl
);
46 op
->exec("rbd", "get_features", bl
);
49 int get_features_finish(bufferlist::const_iterator
*it
, uint64_t *features
,
50 uint64_t *incompatible_features
)
53 decode(*features
, *it
);
54 decode(*incompatible_features
, *it
);
55 } catch (const buffer::error
&err
) {
62 int get_features(librados::IoCtx
*ioctx
, const std::string
&oid
,
63 bool read_only
, uint64_t *features
,
64 uint64_t *incompatible_features
)
66 librados::ObjectReadOperation op
;
67 get_features_start(&op
, read_only
);
70 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
75 auto it
= out_bl
.cbegin();
76 return get_features_finish(&it
, features
, incompatible_features
);
79 void set_features(librados::ObjectWriteOperation
*op
, uint64_t features
,
86 op
->exec("rbd", "set_features", bl
);
89 int set_features(librados::IoCtx
*ioctx
, const std::string
&oid
,
90 uint64_t features
, uint64_t mask
)
92 librados::ObjectWriteOperation op
;
93 set_features(&op
, features
, mask
);
95 return ioctx
->operate(oid
, &op
);
98 void get_object_prefix_start(librados::ObjectReadOperation
*op
)
101 op
->exec("rbd", "get_object_prefix", bl
);
104 int get_object_prefix_finish(bufferlist::const_iterator
*it
,
105 std::string
*object_prefix
)
108 decode(*object_prefix
, *it
);
109 } catch (const buffer::error
&err
) {
115 int get_object_prefix(librados::IoCtx
*ioctx
, const std::string
&oid
,
116 std::string
*object_prefix
)
118 librados::ObjectReadOperation op
;
119 get_object_prefix_start(&op
);
122 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
127 auto it
= out_bl
.cbegin();
128 return get_object_prefix_finish(&it
, object_prefix
);
131 void get_data_pool_start(librados::ObjectReadOperation
*op
) {
133 op
->exec("rbd", "get_data_pool", bl
);
136 int get_data_pool_finish(bufferlist::const_iterator
*it
, int64_t *data_pool_id
) {
138 decode(*data_pool_id
, *it
);
139 } catch (const buffer::error
&err
) {
145 int get_data_pool(librados::IoCtx
*ioctx
, const std::string
&oid
,
146 int64_t *data_pool_id
) {
147 librados::ObjectReadOperation op
;
148 get_data_pool_start(&op
);
151 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
156 auto it
= out_bl
.cbegin();
157 return get_data_pool_finish(&it
, data_pool_id
);
160 void get_size_start(librados::ObjectReadOperation
*op
, snapid_t snap_id
)
164 op
->exec("rbd", "get_size", bl
);
167 int get_size_finish(bufferlist::const_iterator
*it
, uint64_t *size
,
173 } catch (const buffer::error
&err
) {
179 int get_size(librados::IoCtx
*ioctx
, const std::string
&oid
,
180 snapid_t snap_id
, uint64_t *size
, uint8_t *order
)
182 librados::ObjectReadOperation op
;
183 get_size_start(&op
, snap_id
);
186 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
191 auto it
= out_bl
.cbegin();
192 return get_size_finish(&it
, size
, order
);
195 int set_size(librados::IoCtx
*ioctx
, const std::string
&oid
,
198 librados::ObjectWriteOperation op
;
200 return ioctx
->operate(oid
, &op
);
203 void set_size(librados::ObjectWriteOperation
*op
, uint64_t size
)
207 op
->exec("rbd", "set_size", bl
);
210 void get_flags_start(librados::ObjectReadOperation
*op
, snapid_t snap_id
) {
212 encode(static_cast<snapid_t
>(snap_id
), in_bl
);
213 op
->exec("rbd", "get_flags", in_bl
);
216 int get_flags_finish(bufferlist::const_iterator
*it
, uint64_t *flags
) {
219 } catch (const buffer::error
&err
) {
225 int get_flags(librados::IoCtx
*ioctx
, const std::string
&oid
,
226 snapid_t snap_id
, uint64_t *flags
)
228 librados::ObjectReadOperation op
;
229 get_flags_start(&op
, snap_id
);
232 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
237 auto it
= out_bl
.cbegin();
238 return get_flags_finish(&it
, flags
);
241 void set_flags(librados::ObjectWriteOperation
*op
, snapid_t snap_id
,
242 uint64_t flags
, uint64_t mask
)
247 encode(snap_id
, inbl
);
248 op
->exec("rbd", "set_flags", inbl
);
251 void op_features_get_start(librados::ObjectReadOperation
*op
)
254 op
->exec("rbd", "op_features_get", in_bl
);
257 int op_features_get_finish(bufferlist::const_iterator
*it
, uint64_t *op_features
)
260 decode(*op_features
, *it
);
261 } catch (const buffer::error
&err
) {
267 int op_features_get(librados::IoCtx
*ioctx
, const std::string
&oid
,
268 uint64_t *op_features
)
270 librados::ObjectReadOperation op
;
271 op_features_get_start(&op
);
274 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
279 auto it
= out_bl
.cbegin();
280 return op_features_get_finish(&it
, op_features
);
283 void op_features_set(librados::ObjectWriteOperation
*op
,
284 uint64_t op_features
, uint64_t mask
)
287 encode(op_features
, inbl
);
289 op
->exec("rbd", "op_features_set", inbl
);
292 int op_features_set(librados::IoCtx
*ioctx
, const std::string
&oid
,
293 uint64_t op_features
, uint64_t mask
)
295 librados::ObjectWriteOperation op
;
296 op_features_set(&op
, op_features
, mask
);
298 return ioctx
->operate(oid
, &op
);
301 void get_parent_start(librados::ObjectReadOperation
*op
, snapid_t snap_id
)
305 op
->exec("rbd", "get_parent", bl
);
308 int get_parent_finish(bufferlist::const_iterator
*it
,
309 cls::rbd::ParentImageSpec
*pspec
,
310 uint64_t *parent_overlap
)
314 decode(pspec
->pool_id
, *it
);
315 decode(pspec
->image_id
, *it
);
316 decode(pspec
->snap_id
, *it
);
317 decode(*parent_overlap
, *it
);
318 } catch (const buffer::error
&) {
324 int get_parent(librados::IoCtx
*ioctx
, const std::string
&oid
,
325 snapid_t snap_id
, cls::rbd::ParentImageSpec
*pspec
,
326 uint64_t *parent_overlap
)
328 librados::ObjectReadOperation op
;
329 get_parent_start(&op
, snap_id
);
332 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
337 auto it
= out_bl
.cbegin();
338 return get_parent_finish(&it
, pspec
, parent_overlap
);
341 int set_parent(librados::IoCtx
*ioctx
, const std::string
&oid
,
342 const cls::rbd::ParentImageSpec
&pspec
, uint64_t parent_overlap
)
344 librados::ObjectWriteOperation op
;
345 set_parent(&op
, pspec
, parent_overlap
);
346 return ioctx
->operate(oid
, &op
);
349 void set_parent(librados::ObjectWriteOperation
*op
,
350 const cls::rbd::ParentImageSpec
&pspec
,
351 uint64_t parent_overlap
) {
352 assert(pspec
.pool_namespace
.empty());
355 encode(pspec
.pool_id
, in_bl
);
356 encode(pspec
.image_id
, in_bl
);
357 encode(pspec
.snap_id
, in_bl
);
358 encode(parent_overlap
, in_bl
);
360 op
->exec("rbd", "set_parent", in_bl
);
363 int remove_parent(librados::IoCtx
*ioctx
, const std::string
&oid
)
365 librados::ObjectWriteOperation op
;
367 return ioctx
->operate(oid
, &op
);
370 void remove_parent(librados::ObjectWriteOperation
*op
)
373 op
->exec("rbd", "remove_parent", inbl
);
376 void parent_get_start(librados::ObjectReadOperation
* op
) {
378 op
->exec("rbd", "parent_get", in_bl
);
381 int parent_get_finish(bufferlist::const_iterator
* it
,
382 cls::rbd::ParentImageSpec
* parent_image_spec
) {
384 decode(*parent_image_spec
, *it
);
385 } catch (const buffer::error
&) {
391 int parent_get(librados::IoCtx
* ioctx
, const std::string
&oid
,
392 cls::rbd::ParentImageSpec
* parent_image_spec
) {
393 librados::ObjectReadOperation op
;
394 parent_get_start(&op
);
397 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
402 auto it
= out_bl
.cbegin();
403 r
= parent_get_finish(&it
, parent_image_spec
);
410 void parent_overlap_get_start(librados::ObjectReadOperation
* op
,
413 encode(snap_id
, in_bl
);
414 op
->exec("rbd", "parent_overlap_get", in_bl
);
417 int parent_overlap_get_finish(bufferlist::const_iterator
* it
,
418 std::optional
<uint64_t>* parent_overlap
) {
420 decode(*parent_overlap
, *it
);
421 } catch (const buffer::error
&) {
427 int parent_overlap_get(librados::IoCtx
* ioctx
, const std::string
&oid
,
429 std::optional
<uint64_t>* parent_overlap
) {
430 librados::ObjectReadOperation op
;
431 parent_overlap_get_start(&op
, snap_id
);
434 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
439 auto it
= out_bl
.cbegin();
440 r
= parent_overlap_get_finish(&it
, parent_overlap
);
447 void parent_attach(librados::ObjectWriteOperation
* op
,
448 const cls::rbd::ParentImageSpec
& parent_image_spec
,
449 uint64_t parent_overlap
, bool reattach
) {
451 encode(parent_image_spec
, in_bl
);
452 encode(parent_overlap
, in_bl
);
453 encode(reattach
, in_bl
);
454 op
->exec("rbd", "parent_attach", in_bl
);
457 int parent_attach(librados::IoCtx
*ioctx
, const std::string
&oid
,
458 const cls::rbd::ParentImageSpec
& parent_image_spec
,
459 uint64_t parent_overlap
, bool reattach
) {
460 librados::ObjectWriteOperation op
;
461 parent_attach(&op
, parent_image_spec
, parent_overlap
, reattach
);
462 return ioctx
->operate(oid
, &op
);
465 void parent_detach(librados::ObjectWriteOperation
* op
) {
467 op
->exec("rbd", "parent_detach", in_bl
);
470 int parent_detach(librados::IoCtx
*ioctx
, const std::string
&oid
) {
471 librados::ObjectWriteOperation op
;
473 return ioctx
->operate(oid
, &op
);
476 int add_child(librados::IoCtx
*ioctx
, const std::string
&oid
,
477 const cls::rbd::ParentImageSpec
&pspec
,
478 const std::string
&c_imageid
)
480 librados::ObjectWriteOperation op
;
481 add_child(&op
, pspec
, c_imageid
);
482 return ioctx
->operate(oid
, &op
);
485 void add_child(librados::ObjectWriteOperation
*op
,
486 const cls::rbd::ParentImageSpec
& pspec
,
487 const std::string
&c_imageid
)
489 assert(pspec
.pool_namespace
.empty());
492 encode(pspec
.pool_id
, in
);
493 encode(pspec
.image_id
, in
);
494 encode(pspec
.snap_id
, in
);
495 encode(c_imageid
, in
);
497 op
->exec("rbd", "add_child", in
);
500 void remove_child(librados::ObjectWriteOperation
*op
,
501 const cls::rbd::ParentImageSpec
&pspec
,
502 const std::string
&c_imageid
)
504 assert(pspec
.pool_namespace
.empty());
507 encode(pspec
.pool_id
, in
);
508 encode(pspec
.image_id
, in
);
509 encode(pspec
.snap_id
, in
);
510 encode(c_imageid
, in
);
511 op
->exec("rbd", "remove_child", in
);
514 int remove_child(librados::IoCtx
*ioctx
, const std::string
&oid
,
515 const cls::rbd::ParentImageSpec
&pspec
,
516 const std::string
&c_imageid
)
518 librados::ObjectWriteOperation op
;
519 remove_child(&op
, pspec
, c_imageid
);
520 return ioctx
->operate(oid
, &op
);
523 void get_children_start(librados::ObjectReadOperation
*op
,
524 const cls::rbd::ParentImageSpec
&pspec
) {
526 encode(pspec
.pool_id
, in_bl
);
527 encode(pspec
.image_id
, in_bl
);
528 encode(pspec
.snap_id
, in_bl
);
529 op
->exec("rbd", "get_children", in_bl
);
532 int get_children_finish(bufferlist::const_iterator
*it
,
533 std::set
<std::string
>* children
) {
535 decode(*children
, *it
);
536 } catch (const buffer::error
&err
) {
542 int get_children(librados::IoCtx
*ioctx
, const std::string
&oid
,
543 const cls::rbd::ParentImageSpec
&pspec
, set
<string
>& children
)
545 librados::ObjectReadOperation op
;
546 get_children_start(&op
, pspec
);
549 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
554 auto it
= out_bl
.cbegin();
555 return get_children_finish(&it
, &children
);
558 void snapshot_get_start(librados::ObjectReadOperation
*op
, snapid_t snap_id
)
562 op
->exec("rbd", "snapshot_get", bl
);
565 int snapshot_get_finish(bufferlist::const_iterator
* it
,
566 cls::rbd::SnapshotInfo
* snap_info
)
569 decode(*snap_info
, *it
);
570 } catch (const buffer::error
&err
) {
576 int snapshot_get(librados::IoCtx
*ioctx
, const std::string
&oid
,
577 snapid_t snap_id
, cls::rbd::SnapshotInfo
* snap_info
)
579 librados::ObjectReadOperation op
;
580 snapshot_get_start(&op
, snap_id
);
583 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
588 auto it
= out_bl
.cbegin();
589 return snapshot_get_finish(&it
, snap_info
);
592 void snapshot_add(librados::ObjectWriteOperation
*op
, snapid_t snap_id
,
593 const std::string
&snap_name
,
594 const cls::rbd::SnapshotNamespace
&snap_namespace
)
597 encode(snap_name
, bl
);
599 encode(snap_namespace
, bl
);
600 op
->exec("rbd", "snapshot_add", bl
);
603 void snapshot_remove(librados::ObjectWriteOperation
*op
, snapid_t snap_id
)
607 op
->exec("rbd", "snapshot_remove", bl
);
610 void snapshot_rename(librados::ObjectWriteOperation
*op
,
611 snapid_t src_snap_id
,
612 const std::string
&dst_name
)
615 encode(src_snap_id
, bl
);
616 encode(dst_name
, bl
);
617 op
->exec("rbd", "snapshot_rename", bl
);
620 void snapshot_trash_add(librados::ObjectWriteOperation
*op
,
625 op
->exec("rbd", "snapshot_trash_add", bl
);
628 void get_snapcontext_start(librados::ObjectReadOperation
*op
)
631 op
->exec("rbd", "get_snapcontext", bl
);
634 int get_snapcontext_finish(bufferlist::const_iterator
*it
,
635 ::SnapContext
*snapc
)
639 } catch (const buffer::error
&err
) {
642 if (!snapc
->is_valid()) {
648 int get_snapcontext(librados::IoCtx
*ioctx
, const std::string
&oid
,
649 ::SnapContext
*snapc
)
651 librados::ObjectReadOperation op
;
652 get_snapcontext_start(&op
);
655 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
660 auto bl_it
= out_bl
.cbegin();
661 return get_snapcontext_finish(&bl_it
, snapc
);
664 void get_snapshot_name_start(librados::ObjectReadOperation
*op
,
669 op
->exec("rbd", "get_snapshot_name", bl
);
672 int get_snapshot_name_finish(bufferlist::const_iterator
*it
,
677 } catch (const buffer::error
&err
) {
683 int get_snapshot_name(librados::IoCtx
*ioctx
, const std::string
&oid
,
684 snapid_t snap_id
, std::string
*name
)
686 librados::ObjectReadOperation op
;
687 get_snapshot_name_start(&op
, snap_id
);
690 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
695 auto it
= out_bl
.cbegin();
696 return get_snapshot_name_finish(&it
, name
);
699 void get_snapshot_timestamp_start(librados::ObjectReadOperation
*op
,
704 op
->exec("rbd", "get_snapshot_timestamp", bl
);
707 int get_snapshot_timestamp_finish(bufferlist::const_iterator
*it
,
711 decode(*timestamp
, *it
);
712 } catch (const buffer::error
&err
) {
718 int get_snapshot_timestamp(librados::IoCtx
*ioctx
, const std::string
&oid
,
719 snapid_t snap_id
, utime_t
*timestamp
)
721 librados::ObjectReadOperation op
;
722 get_snapshot_timestamp_start(&op
, snap_id
);
725 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
730 auto it
= out_bl
.cbegin();
731 return get_snapshot_timestamp_finish(&it
, timestamp
);
734 void old_snapshot_add(librados::ObjectWriteOperation
*op
,
735 snapid_t snap_id
, const std::string
&snap_name
)
738 encode(snap_name
, bl
);
740 op
->exec("rbd", "snap_add", bl
);
743 void old_snapshot_remove(librados::ObjectWriteOperation
*op
,
744 const std::string
&snap_name
)
747 encode(snap_name
, bl
);
748 op
->exec("rbd", "snap_remove", bl
);
751 void old_snapshot_rename(librados::ObjectWriteOperation
*op
,
752 snapid_t src_snap_id
, const std::string
&dst_name
)
755 encode(src_snap_id
, bl
);
756 encode(dst_name
, bl
);
757 op
->exec("rbd", "snap_rename", bl
);
760 void old_snapshot_list_start(librados::ObjectReadOperation
*op
) {
762 op
->exec("rbd", "snap_list", in_bl
);
765 int old_snapshot_list_finish(bufferlist::const_iterator
*it
,
766 std::vector
<string
> *names
,
767 std::vector
<uint64_t> *sizes
,
768 ::SnapContext
*snapc
) {
771 decode(snapc
->seq
, *it
);
772 decode(num_snaps
, *it
);
774 names
->resize(num_snaps
);
775 sizes
->resize(num_snaps
);
776 snapc
->snaps
.resize(num_snaps
);
777 for (uint32_t i
= 0; i
< num_snaps
; ++i
) {
778 decode(snapc
->snaps
[i
], *it
);
779 decode((*sizes
)[i
], *it
);
780 decode((*names
)[i
], *it
);
782 } catch (const buffer::error
&err
) {
788 int old_snapshot_list(librados::IoCtx
*ioctx
, const std::string
&oid
,
789 std::vector
<string
> *names
,
790 std::vector
<uint64_t> *sizes
,
791 ::SnapContext
*snapc
)
793 librados::ObjectReadOperation op
;
794 old_snapshot_list_start(&op
);
797 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
802 auto it
= out_bl
.cbegin();
803 return old_snapshot_list_finish(&it
, names
, sizes
, snapc
);
806 void get_all_features_start(librados::ObjectReadOperation
*op
) {
808 op
->exec("rbd", "get_all_features", in
);
811 int get_all_features_finish(bufferlist::const_iterator
*it
,
812 uint64_t *all_features
) {
814 decode(*all_features
, *it
);
815 } catch (const buffer::error
&err
) {
821 int get_all_features(librados::IoCtx
*ioctx
, const std::string
&oid
,
822 uint64_t *all_features
) {
823 librados::ObjectReadOperation op
;
824 get_all_features_start(&op
);
827 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
832 auto it
= out_bl
.cbegin();
833 return get_all_features_finish(&it
, all_features
);
836 int copyup(librados::IoCtx
*ioctx
, const std::string
&oid
,
839 return ioctx
->exec(oid
, "rbd", "copyup", data
, out
);
842 void get_protection_status_start(librados::ObjectReadOperation
*op
,
847 op
->exec("rbd", "get_protection_status", bl
);
850 int get_protection_status_finish(bufferlist::const_iterator
*it
,
851 uint8_t *protection_status
)
854 decode(*protection_status
, *it
);
855 } catch (const buffer::error
&) {
861 int get_protection_status(librados::IoCtx
*ioctx
, const std::string
&oid
,
862 snapid_t snap_id
, uint8_t *protection_status
)
864 librados::ObjectReadOperation op
;
865 get_protection_status_start(&op
, snap_id
);
868 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
873 auto it
= out_bl
.cbegin();
874 return get_protection_status_finish(&it
, protection_status
);
877 int set_protection_status(librados::IoCtx
*ioctx
, const std::string
&oid
,
878 snapid_t snap_id
, uint8_t protection_status
)
881 librados::ObjectWriteOperation op
;
882 set_protection_status(&op
, snap_id
, protection_status
);
883 return ioctx
->operate(oid
, &op
);
886 void set_protection_status(librados::ObjectWriteOperation
*op
,
887 snapid_t snap_id
, uint8_t protection_status
)
891 encode(protection_status
, in
);
892 op
->exec("rbd", "set_protection_status", in
);
895 int snapshot_get_limit(librados::IoCtx
*ioctx
, const std::string
&oid
,
899 int r
= ioctx
->exec(oid
, "rbd", "snapshot_get_limit", in
, out
);
906 auto iter
= out
.cbegin();
907 decode(*limit
, iter
);
908 } catch (const buffer::error
&err
) {
915 void snapshot_set_limit(librados::ObjectWriteOperation
*op
, uint64_t limit
)
919 op
->exec("rbd", "snapshot_set_limit", in
);
922 void get_stripe_unit_count_start(librados::ObjectReadOperation
*op
) {
924 op
->exec("rbd", "get_stripe_unit_count", empty_bl
);
927 int get_stripe_unit_count_finish(bufferlist::const_iterator
*it
,
928 uint64_t *stripe_unit
,
929 uint64_t *stripe_count
) {
930 ceph_assert(stripe_unit
);
931 ceph_assert(stripe_count
);
934 decode(*stripe_unit
, *it
);
935 decode(*stripe_count
, *it
);
936 } catch (const buffer::error
&err
) {
942 int get_stripe_unit_count(librados::IoCtx
*ioctx
, const std::string
&oid
,
943 uint64_t *stripe_unit
, uint64_t *stripe_count
)
945 librados::ObjectReadOperation op
;
946 get_stripe_unit_count_start(&op
);
949 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
954 auto it
= out_bl
.cbegin();
955 return get_stripe_unit_count_finish(&it
, stripe_unit
, stripe_count
);
958 void set_stripe_unit_count(librados::ObjectWriteOperation
*op
,
959 uint64_t stripe_unit
, uint64_t stripe_count
)
962 encode(stripe_unit
, bl
);
963 encode(stripe_count
, bl
);
965 op
->exec("rbd", "set_stripe_unit_count", bl
);
968 int set_stripe_unit_count(librados::IoCtx
*ioctx
, const std::string
&oid
,
969 uint64_t stripe_unit
, uint64_t stripe_count
)
971 librados::ObjectWriteOperation op
;
972 set_stripe_unit_count(&op
, stripe_unit
, stripe_count
);
974 return ioctx
->operate(oid
, &op
);
977 void get_create_timestamp_start(librados::ObjectReadOperation
*op
) {
979 op
->exec("rbd", "get_create_timestamp", empty_bl
);
982 int get_create_timestamp_finish(bufferlist::const_iterator
*it
,
983 utime_t
*timestamp
) {
984 ceph_assert(timestamp
);
987 decode(*timestamp
, *it
);
988 } catch (const buffer::error
&err
) {
994 int get_create_timestamp(librados::IoCtx
*ioctx
, const std::string
&oid
,
997 librados::ObjectReadOperation op
;
998 get_create_timestamp_start(&op
);
1001 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
1006 auto it
= out_bl
.cbegin();
1007 return get_create_timestamp_finish(&it
, timestamp
);
1010 void get_access_timestamp_start(librados::ObjectReadOperation
*op
) {
1011 bufferlist empty_bl
;
1012 op
->exec("rbd", "get_access_timestamp", empty_bl
);
1015 int get_access_timestamp_finish(bufferlist::const_iterator
*it
,
1016 utime_t
*timestamp
) {
1017 ceph_assert(timestamp
);
1020 decode(*timestamp
, *it
);
1021 } catch (const buffer::error
&err
) {
1027 int get_access_timestamp(librados::IoCtx
*ioctx
, const std::string
&oid
,
1030 librados::ObjectReadOperation op
;
1031 get_access_timestamp_start(&op
);
1034 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
1039 auto it
= out_bl
.cbegin();
1040 return get_access_timestamp_finish(&it
, timestamp
);
1043 void set_access_timestamp(librados::ObjectWriteOperation
*op
)
1045 bufferlist empty_bl
;
1046 op
->exec("rbd","set_access_timestamp",empty_bl
);
1049 int set_access_timestamp(librados::IoCtx
*ioctx
, const std::string
&oid
)
1051 librados::ObjectWriteOperation op
;
1052 set_access_timestamp(&op
);
1053 return ioctx
->operate(oid
, &op
);
1056 void get_modify_timestamp_start(librados::ObjectReadOperation
*op
) {
1057 bufferlist empty_bl
;
1058 op
->exec("rbd", "get_modify_timestamp", empty_bl
);
1061 int get_modify_timestamp_finish(bufferlist::const_iterator
*it
,
1062 utime_t
*timestamp
) {
1063 ceph_assert(timestamp
);
1066 decode(*timestamp
, *it
);
1067 } catch (const buffer::error
&err
) {
1073 int get_modify_timestamp(librados::IoCtx
*ioctx
, const std::string
&oid
,
1076 librados::ObjectReadOperation op
;
1077 get_modify_timestamp_start(&op
);
1080 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
1085 auto it
= out_bl
.cbegin();
1086 return get_modify_timestamp_finish(&it
, timestamp
);
1089 void set_modify_timestamp(librados::ObjectWriteOperation
*op
)
1091 bufferlist empty_bl
;
1092 op
->exec("rbd","set_modify_timestamp",empty_bl
);
1095 int set_modify_timestamp(librados::IoCtx
*ioctx
, const std::string
&oid
)
1097 librados::ObjectWriteOperation op
;
1098 set_modify_timestamp(&op
);
1099 return ioctx
->operate(oid
, &op
);
1103 /************************ rbd_id object methods ************************/
1105 void get_id_start(librados::ObjectReadOperation
*op
) {
1106 bufferlist empty_bl
;
1107 op
->exec("rbd", "get_id", empty_bl
);
1110 int get_id_finish(bufferlist::const_iterator
*it
, std::string
*id
) {
1113 } catch (const buffer::error
&err
) {
1119 int get_id(librados::IoCtx
*ioctx
, const std::string
&oid
, std::string
*id
)
1121 librados::ObjectReadOperation op
;
1125 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
1130 auto it
= out_bl
.cbegin();
1131 return get_id_finish(&it
, id
);
1134 void set_id(librados::ObjectWriteOperation
*op
, const std::string
&id
)
1138 op
->exec("rbd", "set_id", bl
);
1141 int set_id(librados::IoCtx
*ioctx
, const std::string
&oid
, const std::string
&id
)
1143 librados::ObjectWriteOperation op
;
1146 return ioctx
->operate(oid
, &op
);
1149 /******************** rbd_directory object methods ********************/
1151 void dir_get_id_start(librados::ObjectReadOperation
*op
,
1152 const std::string
&image_name
) {
1154 encode(image_name
, bl
);
1156 op
->exec("rbd", "dir_get_id", bl
);
1159 int dir_get_id_finish(bufferlist::const_iterator
*iter
, std::string
*image_id
) {
1161 decode(*image_id
, *iter
);
1162 } catch (const buffer::error
&err
) {
1169 int dir_get_id(librados::IoCtx
*ioctx
, const std::string
&oid
,
1170 const std::string
&name
, std::string
*id
) {
1171 librados::ObjectReadOperation op
;
1172 dir_get_id_start(&op
, name
);
1175 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
1180 auto iter
= out_bl
.cbegin();
1181 return dir_get_id_finish(&iter
, id
);
1184 void dir_get_name_start(librados::ObjectReadOperation
*op
,
1185 const std::string
&id
) {
1188 op
->exec("rbd", "dir_get_name", in_bl
);
1191 int dir_get_name_finish(bufferlist::const_iterator
*it
, std::string
*name
) {
1194 } catch (const buffer::error
&err
) {
1200 int dir_get_name(librados::IoCtx
*ioctx
, const std::string
&oid
,
1201 const std::string
&id
, std::string
*name
) {
1202 librados::ObjectReadOperation op
;
1203 dir_get_name_start(&op
, id
);
1206 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
1211 auto it
= out_bl
.cbegin();
1212 return dir_get_name_finish(&it
, name
);
1215 void dir_list_start(librados::ObjectReadOperation
*op
,
1216 const std::string
&start
, uint64_t max_return
)
1219 encode(start
, in_bl
);
1220 encode(max_return
, in_bl
);
1222 op
->exec("rbd", "dir_list", in_bl
);
1225 int dir_list_finish(bufferlist::const_iterator
*it
, map
<string
, string
> *images
)
1228 decode(*images
, *it
);
1229 } catch (const buffer::error
&err
) {
1235 int dir_list(librados::IoCtx
*ioctx
, const std::string
&oid
,
1236 const std::string
&start
, uint64_t max_return
,
1237 map
<string
, string
> *images
)
1239 librados::ObjectReadOperation op
;
1240 dir_list_start(&op
, start
, max_return
);
1243 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
1248 auto iter
= out_bl
.cbegin();
1249 return dir_list_finish(&iter
, images
);
1252 void dir_add_image(librados::ObjectWriteOperation
*op
,
1253 const std::string
&name
, const std::string
&id
)
1258 op
->exec("rbd", "dir_add_image", bl
);
1261 int dir_add_image(librados::IoCtx
*ioctx
, const std::string
&oid
,
1262 const std::string
&name
, const std::string
&id
)
1264 librados::ObjectWriteOperation op
;
1265 dir_add_image(&op
, name
, id
);
1267 return ioctx
->operate(oid
, &op
);
1270 int dir_remove_image(librados::IoCtx
*ioctx
, const std::string
&oid
,
1271 const std::string
&name
, const std::string
&id
)
1273 librados::ObjectWriteOperation op
;
1274 dir_remove_image(&op
, name
, id
);
1276 return ioctx
->operate(oid
, &op
);
1279 void dir_state_assert(librados::ObjectOperation
*op
,
1280 cls::rbd::DirectoryState directory_state
)
1283 encode(directory_state
, bl
);
1284 op
->exec("rbd", "dir_state_assert", bl
);
1287 int dir_state_assert(librados::IoCtx
*ioctx
, const std::string
&oid
,
1288 cls::rbd::DirectoryState directory_state
)
1290 librados::ObjectWriteOperation op
;
1291 dir_state_assert(&op
, directory_state
);
1293 return ioctx
->operate(oid
, &op
);
1296 void dir_state_set(librados::ObjectWriteOperation
*op
,
1297 cls::rbd::DirectoryState directory_state
)
1300 encode(directory_state
, bl
);
1301 op
->exec("rbd", "dir_state_set", bl
);
1304 int dir_state_set(librados::IoCtx
*ioctx
, const std::string
&oid
,
1305 cls::rbd::DirectoryState directory_state
)
1307 librados::ObjectWriteOperation op
;
1308 dir_state_set(&op
, directory_state
);
1310 return ioctx
->operate(oid
, &op
);
1313 void dir_remove_image(librados::ObjectWriteOperation
*op
,
1314 const std::string
&name
, const std::string
&id
)
1320 op
->exec("rbd", "dir_remove_image", bl
);
1323 void dir_rename_image(librados::ObjectWriteOperation
*op
,
1324 const std::string
&src
, const std::string
&dest
,
1325 const std::string
&id
)
1331 op
->exec("rbd", "dir_rename_image", in
);
1334 void object_map_load_start(librados::ObjectReadOperation
*op
) {
1336 op
->exec("rbd", "object_map_load", in_bl
);
1339 int object_map_load_finish(bufferlist::const_iterator
*it
,
1340 ceph::BitVector
<2> *object_map
) {
1342 decode(*object_map
, *it
);
1343 } catch (const buffer::error
&err
) {
1349 int object_map_load(librados::IoCtx
*ioctx
, const std::string
&oid
,
1350 ceph::BitVector
<2> *object_map
)
1352 librados::ObjectReadOperation op
;
1353 object_map_load_start(&op
);
1356 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
1361 auto it
= out_bl
.cbegin();
1362 return object_map_load_finish(&it
, object_map
);
1365 void object_map_save(librados::ObjectWriteOperation
*rados_op
,
1366 const ceph::BitVector
<2> &object_map
)
1368 ceph::BitVector
<2> object_map_copy(object_map
);
1369 object_map_copy
.set_crc_enabled(false);
1372 encode(object_map_copy
, in
);
1373 rados_op
->exec("rbd", "object_map_save", in
);
1376 void object_map_resize(librados::ObjectWriteOperation
*rados_op
,
1377 uint64_t object_count
, uint8_t default_state
)
1380 encode(object_count
, in
);
1381 encode(default_state
, in
);
1382 rados_op
->exec("rbd", "object_map_resize", in
);
1385 void object_map_update(librados::ObjectWriteOperation
*rados_op
,
1386 uint64_t start_object_no
, uint64_t end_object_no
,
1387 uint8_t new_object_state
,
1388 const boost::optional
<uint8_t> ¤t_object_state
)
1391 encode(start_object_no
, in
);
1392 encode(end_object_no
, in
);
1393 encode(new_object_state
, in
);
1394 encode(current_object_state
, in
);
1395 rados_op
->exec("rbd", "object_map_update", in
);
1398 void object_map_snap_add(librados::ObjectWriteOperation
*rados_op
)
1401 rados_op
->exec("rbd", "object_map_snap_add", in
);
1404 void object_map_snap_remove(librados::ObjectWriteOperation
*rados_op
,
1405 const ceph::BitVector
<2> &object_map
)
1407 ceph::BitVector
<2> object_map_copy(object_map
);
1408 object_map_copy
.set_crc_enabled(false);
1411 encode(object_map_copy
, in
);
1412 rados_op
->exec("rbd", "object_map_snap_remove", in
);
1415 void metadata_set(librados::ObjectWriteOperation
*op
,
1416 const map
<string
, bufferlist
> &data
)
1421 op
->exec("rbd", "metadata_set", bl
);
1424 int metadata_set(librados::IoCtx
*ioctx
, const std::string
&oid
,
1425 const map
<string
, bufferlist
> &data
)
1427 librados::ObjectWriteOperation op
;
1428 metadata_set(&op
, data
);
1430 return ioctx
->operate(oid
, &op
);
1433 void metadata_remove(librados::ObjectWriteOperation
*op
,
1434 const std::string
&key
)
1439 op
->exec("rbd", "metadata_remove", bl
);
1442 int metadata_remove(librados::IoCtx
*ioctx
, const std::string
&oid
,
1443 const std::string
&key
)
1445 librados::ObjectWriteOperation op
;
1446 metadata_remove(&op
, key
);
1448 return ioctx
->operate(oid
, &op
);
1451 int metadata_list(librados::IoCtx
*ioctx
, const std::string
&oid
,
1452 const std::string
&start
, uint64_t max_return
,
1453 map
<string
, bufferlist
> *pairs
)
1455 librados::ObjectReadOperation op
;
1456 metadata_list_start(&op
, start
, max_return
);
1459 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
1464 auto it
= out_bl
.cbegin();
1465 return metadata_list_finish(&it
, pairs
);
1468 void metadata_list_start(librados::ObjectReadOperation
*op
,
1469 const std::string
&start
, uint64_t max_return
)
1472 encode(start
, in_bl
);
1473 encode(max_return
, in_bl
);
1474 op
->exec("rbd", "metadata_list", in_bl
);
1477 int metadata_list_finish(bufferlist::const_iterator
*it
,
1478 std::map
<std::string
, bufferlist
> *pairs
)
1482 decode(*pairs
, *it
);
1483 } catch (const buffer::error
&err
) {
1489 int metadata_get(librados::IoCtx
*ioctx
, const std::string
&oid
,
1490 const std::string
&key
, string
*s
)
1495 int r
= ioctx
->exec(oid
, "rbd", "metadata_get", in
, out
);
1499 auto iter
= out
.cbegin();
1502 } catch (const buffer::error
&err
) {
1509 void child_attach(librados::ObjectWriteOperation
*op
, snapid_t snap_id
,
1510 const cls::rbd::ChildImageSpec
& child_image
)
1513 encode(snap_id
, bl
);
1514 encode(child_image
, bl
);
1515 op
->exec("rbd", "child_attach", bl
);
1518 int child_attach(librados::IoCtx
*ioctx
, const std::string
&oid
,
1520 const cls::rbd::ChildImageSpec
& child_image
)
1522 librados::ObjectWriteOperation op
;
1523 child_attach(&op
, snap_id
, child_image
);
1525 int r
= ioctx
->operate(oid
, &op
);
1532 void child_detach(librados::ObjectWriteOperation
*op
, snapid_t snap_id
,
1533 const cls::rbd::ChildImageSpec
& child_image
)
1536 encode(snap_id
, bl
);
1537 encode(child_image
, bl
);
1538 op
->exec("rbd", "child_detach", bl
);
1541 int child_detach(librados::IoCtx
*ioctx
, const std::string
&oid
,
1543 const cls::rbd::ChildImageSpec
& child_image
)
1545 librados::ObjectWriteOperation op
;
1546 child_detach(&op
, snap_id
, child_image
);
1548 int r
= ioctx
->operate(oid
, &op
);
1555 void children_list_start(librados::ObjectReadOperation
*op
,
1559 encode(snap_id
, bl
);
1560 op
->exec("rbd", "children_list", bl
);
1563 int children_list_finish(bufferlist::const_iterator
*it
,
1564 cls::rbd::ChildImageSpecs
*child_images
)
1566 child_images
->clear();
1568 decode(*child_images
, *it
);
1569 } catch (const buffer::error
&err
) {
1575 int children_list(librados::IoCtx
*ioctx
, const std::string
&oid
,
1577 cls::rbd::ChildImageSpecs
*child_images
)
1579 librados::ObjectReadOperation op
;
1580 children_list_start(&op
, snap_id
);
1583 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
1588 auto it
= out_bl
.cbegin();
1589 r
= children_list_finish(&it
, child_images
);
1596 int migration_set(librados::IoCtx
*ioctx
, const std::string
&oid
,
1597 const cls::rbd::MigrationSpec
&migration_spec
) {
1598 librados::ObjectWriteOperation op
;
1599 migration_set(&op
, migration_spec
);
1600 return ioctx
->operate(oid
, &op
);
1603 void migration_set(librados::ObjectWriteOperation
*op
,
1604 const cls::rbd::MigrationSpec
&migration_spec
) {
1606 encode(migration_spec
, bl
);
1607 op
->exec("rbd", "migration_set", bl
);
1610 int migration_set_state(librados::IoCtx
*ioctx
, const std::string
&oid
,
1611 cls::rbd::MigrationState state
,
1612 const std::string
&description
) {
1613 librados::ObjectWriteOperation op
;
1614 migration_set_state(&op
, state
, description
);
1615 return ioctx
->operate(oid
, &op
);
1618 void migration_set_state(librados::ObjectWriteOperation
*op
,
1619 cls::rbd::MigrationState state
,
1620 const std::string
&description
) {
1623 encode(description
, bl
);
1624 op
->exec("rbd", "migration_set_state", bl
);
1627 void migration_get_start(librados::ObjectReadOperation
*op
) {
1629 op
->exec("rbd", "migration_get", bl
);
1632 int migration_get_finish(bufferlist::const_iterator
*it
,
1633 cls::rbd::MigrationSpec
*migration_spec
) {
1635 decode(*migration_spec
, *it
);
1636 } catch (const buffer::error
&err
) {
1642 int migration_get(librados::IoCtx
*ioctx
, const std::string
&oid
,
1643 cls::rbd::MigrationSpec
*migration_spec
) {
1644 librados::ObjectReadOperation op
;
1645 migration_get_start(&op
);
1648 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
1653 auto iter
= out_bl
.cbegin();
1654 r
= migration_get_finish(&iter
, migration_spec
);
1661 int migration_remove(librados::IoCtx
*ioctx
, const std::string
&oid
) {
1662 librados::ObjectWriteOperation op
;
1663 migration_remove(&op
);
1664 return ioctx
->operate(oid
, &op
);
1667 void migration_remove(librados::ObjectWriteOperation
*op
) {
1669 op
->exec("rbd", "migration_remove", bl
);
1672 int assert_snapc_seq(librados::IoCtx
*ioctx
, const std::string
&oid
,
1674 cls::rbd::AssertSnapcSeqState state
) {
1675 librados::ObjectWriteOperation op
;
1676 assert_snapc_seq(&op
, snapc_seq
, state
);
1677 return ioctx
->operate(oid
, &op
);
1680 void assert_snapc_seq(librados::ObjectWriteOperation
*op
,
1682 cls::rbd::AssertSnapcSeqState state
) {
1684 encode(snapc_seq
, bl
);
1686 op
->exec("rbd", "assert_snapc_seq", bl
);
1689 void mirror_uuid_get_start(librados::ObjectReadOperation
*op
) {
1691 op
->exec("rbd", "mirror_uuid_get", bl
);
1694 int mirror_uuid_get_finish(bufferlist::const_iterator
*it
,
1695 std::string
*uuid
) {
1698 } catch (const buffer::error
&err
) {
1704 int mirror_uuid_get(librados::IoCtx
*ioctx
, std::string
*uuid
) {
1705 librados::ObjectReadOperation op
;
1706 mirror_uuid_get_start(&op
);
1709 int r
= ioctx
->operate(RBD_MIRRORING
, &op
, &out_bl
);
1714 auto it
= out_bl
.cbegin();
1715 r
= mirror_uuid_get_finish(&it
, uuid
);
1722 int mirror_uuid_set(librados::IoCtx
*ioctx
, const std::string
&uuid
) {
1724 encode(uuid
, in_bl
);
1727 int r
= ioctx
->exec(RBD_MIRRORING
, "rbd", "mirror_uuid_set", in_bl
,
1735 void mirror_mode_get_start(librados::ObjectReadOperation
*op
) {
1737 op
->exec("rbd", "mirror_mode_get", bl
);
1740 int mirror_mode_get_finish(bufferlist::const_iterator
*it
,
1741 cls::rbd::MirrorMode
*mirror_mode
) {
1743 uint32_t mirror_mode_decode
;
1744 decode(mirror_mode_decode
, *it
);
1745 *mirror_mode
= static_cast<cls::rbd::MirrorMode
>(mirror_mode_decode
);
1746 } catch (const buffer::error
&err
) {
1753 int mirror_mode_get(librados::IoCtx
*ioctx
,
1754 cls::rbd::MirrorMode
*mirror_mode
) {
1755 librados::ObjectReadOperation op
;
1756 mirror_mode_get_start(&op
);
1759 int r
= ioctx
->operate(RBD_MIRRORING
, &op
, &out_bl
);
1761 *mirror_mode
= cls::rbd::MIRROR_MODE_DISABLED
;
1767 auto it
= out_bl
.cbegin();
1768 r
= mirror_mode_get_finish(&it
, mirror_mode
);
1775 int mirror_mode_set(librados::IoCtx
*ioctx
,
1776 cls::rbd::MirrorMode mirror_mode
) {
1778 encode(static_cast<uint32_t>(mirror_mode
), in_bl
);
1781 int r
= ioctx
->exec(RBD_MIRRORING
, "rbd", "mirror_mode_set", in_bl
,
1789 int mirror_peer_list(librados::IoCtx
*ioctx
,
1790 std::vector
<cls::rbd::MirrorPeer
> *peers
) {
1793 int r
= ioctx
->exec(RBD_MIRRORING
, "rbd", "mirror_peer_list", in_bl
,
1801 auto bl_it
= out_bl
.cbegin();
1802 decode(*peers
, bl_it
);
1803 } catch (const buffer::error
&err
) {
1809 int mirror_peer_add(librados::IoCtx
*ioctx
, const std::string
&uuid
,
1810 const std::string
&cluster_name
,
1811 const std::string
&client_name
) {
1812 cls::rbd::MirrorPeer
peer(uuid
, cluster_name
, client_name
, -1);
1814 encode(peer
, in_bl
);
1817 int r
= ioctx
->exec(RBD_MIRRORING
, "rbd", "mirror_peer_add", in_bl
,
1825 int mirror_peer_remove(librados::IoCtx
*ioctx
,
1826 const std::string
&uuid
) {
1828 encode(uuid
, in_bl
);
1831 int r
= ioctx
->exec(RBD_MIRRORING
, "rbd", "mirror_peer_remove", in_bl
,
1839 int mirror_peer_set_client(librados::IoCtx
*ioctx
,
1840 const std::string
&uuid
,
1841 const std::string
&client_name
) {
1843 encode(uuid
, in_bl
);
1844 encode(client_name
, in_bl
);
1847 int r
= ioctx
->exec(RBD_MIRRORING
, "rbd", "mirror_peer_set_client",
1855 int mirror_peer_set_cluster(librados::IoCtx
*ioctx
,
1856 const std::string
&uuid
,
1857 const std::string
&cluster_name
) {
1859 encode(uuid
, in_bl
);
1860 encode(cluster_name
, in_bl
);
1863 int r
= ioctx
->exec(RBD_MIRRORING
, "rbd", "mirror_peer_set_cluster",
1871 void mirror_image_list_start(librados::ObjectReadOperation
*op
,
1872 const std::string
&start
, uint64_t max_return
)
1875 encode(start
, in_bl
);
1876 encode(max_return
, in_bl
);
1877 op
->exec("rbd", "mirror_image_list", in_bl
);
1880 int mirror_image_list_finish(bufferlist::const_iterator
*it
,
1881 std::map
<string
, string
> *mirror_image_ids
)
1884 decode(*mirror_image_ids
, *it
);
1885 } catch (const buffer::error
&err
) {
1891 int mirror_image_list(librados::IoCtx
*ioctx
,
1892 const std::string
&start
, uint64_t max_return
,
1893 std::map
<std::string
, std::string
> *mirror_image_ids
) {
1894 librados::ObjectReadOperation op
;
1895 mirror_image_list_start(&op
, start
, max_return
);
1898 int r
= ioctx
->operate(RBD_MIRRORING
, &op
, &out_bl
);
1903 auto bl_it
= out_bl
.cbegin();
1904 return mirror_image_list_finish(&bl_it
, mirror_image_ids
);
1907 void mirror_image_get_image_id_start(librados::ObjectReadOperation
*op
,
1908 const std::string
&global_image_id
) {
1910 encode(global_image_id
, in_bl
);
1911 op
->exec( "rbd", "mirror_image_get_image_id", in_bl
);
1914 int mirror_image_get_image_id_finish(bufferlist::const_iterator
*it
,
1915 std::string
*image_id
) {
1917 decode(*image_id
, *it
);
1918 } catch (const buffer::error
&err
) {
1924 int mirror_image_get_image_id(librados::IoCtx
*ioctx
,
1925 const std::string
&global_image_id
,
1926 std::string
*image_id
) {
1927 librados::ObjectReadOperation op
;
1928 mirror_image_get_image_id_start(&op
, global_image_id
);
1931 int r
= ioctx
->operate(RBD_MIRRORING
, &op
, &out_bl
);
1936 auto it
= out_bl
.cbegin();
1937 return mirror_image_get_image_id_finish(&it
, image_id
);
1940 int mirror_image_get(librados::IoCtx
*ioctx
, const std::string
&image_id
,
1941 cls::rbd::MirrorImage
*mirror_image
) {
1942 librados::ObjectReadOperation op
;
1943 mirror_image_get_start(&op
, image_id
);
1946 int r
= ioctx
->operate(RBD_MIRRORING
, &op
, &out_bl
);
1951 auto iter
= out_bl
.cbegin();
1952 r
= mirror_image_get_finish(&iter
, mirror_image
);
1959 void mirror_image_get_start(librados::ObjectReadOperation
*op
,
1960 const std::string
&image_id
) {
1962 encode(image_id
, in_bl
);
1964 op
->exec("rbd", "mirror_image_get", in_bl
);
1967 int mirror_image_get_finish(bufferlist::const_iterator
*iter
,
1968 cls::rbd::MirrorImage
*mirror_image
) {
1970 decode(*mirror_image
, *iter
);
1971 } catch (const buffer::error
&err
) {
1977 void mirror_image_set(librados::ObjectWriteOperation
*op
,
1978 const std::string
&image_id
,
1979 const cls::rbd::MirrorImage
&mirror_image
) {
1981 encode(image_id
, bl
);
1982 encode(mirror_image
, bl
);
1984 op
->exec("rbd", "mirror_image_set", bl
);
1987 int mirror_image_set(librados::IoCtx
*ioctx
, const std::string
&image_id
,
1988 const cls::rbd::MirrorImage
&mirror_image
) {
1989 librados::ObjectWriteOperation op
;
1990 mirror_image_set(&op
, image_id
, mirror_image
);
1992 int r
= ioctx
->operate(RBD_MIRRORING
, &op
);
1999 void mirror_image_remove(librados::ObjectWriteOperation
*op
,
2000 const std::string
&image_id
) {
2002 encode(image_id
, bl
);
2004 op
->exec("rbd", "mirror_image_remove", bl
);
2007 int mirror_image_remove(librados::IoCtx
*ioctx
, const std::string
&image_id
) {
2008 librados::ObjectWriteOperation op
;
2009 mirror_image_remove(&op
, image_id
);
2011 int r
= ioctx
->operate(RBD_MIRRORING
, &op
);
2018 int mirror_image_status_set(librados::IoCtx
*ioctx
,
2019 const std::string
&global_image_id
,
2020 const cls::rbd::MirrorImageStatus
&status
) {
2021 librados::ObjectWriteOperation op
;
2022 mirror_image_status_set(&op
, global_image_id
, status
);
2023 return ioctx
->operate(RBD_MIRRORING
, &op
);
2026 void mirror_image_status_set(librados::ObjectWriteOperation
*op
,
2027 const std::string
&global_image_id
,
2028 const cls::rbd::MirrorImageStatus
&status
) {
2030 encode(global_image_id
, bl
);
2032 op
->exec("rbd", "mirror_image_status_set", bl
);
2035 int mirror_image_status_remove(librados::IoCtx
*ioctx
,
2036 const std::string
&global_image_id
) {
2037 librados::ObjectWriteOperation op
;
2038 mirror_image_status_remove(&op
, global_image_id
);
2039 return ioctx
->operate(RBD_MIRRORING
, &op
);
2042 void mirror_image_status_remove(librados::ObjectWriteOperation
*op
,
2043 const std::string
&global_image_id
) {
2045 encode(global_image_id
, bl
);
2046 op
->exec("rbd", "mirror_image_status_remove", bl
);
2049 int mirror_image_status_get(librados::IoCtx
*ioctx
,
2050 const std::string
&global_image_id
,
2051 cls::rbd::MirrorImageStatus
*status
) {
2052 librados::ObjectReadOperation op
;
2053 mirror_image_status_get_start(&op
, global_image_id
);
2056 int r
= ioctx
->operate(RBD_MIRRORING
, &op
, &out_bl
);
2061 auto iter
= out_bl
.cbegin();
2062 r
= mirror_image_status_get_finish(&iter
, status
);
2069 void mirror_image_status_get_start(librados::ObjectReadOperation
*op
,
2070 const std::string
&global_image_id
) {
2072 encode(global_image_id
, bl
);
2073 op
->exec("rbd", "mirror_image_status_get", bl
);
2076 int mirror_image_status_get_finish(bufferlist::const_iterator
*iter
,
2077 cls::rbd::MirrorImageStatus
*status
) {
2079 decode(*status
, *iter
);
2080 } catch (const buffer::error
&err
) {
2086 int mirror_image_status_list(librados::IoCtx
*ioctx
,
2087 const std::string
&start
, uint64_t max_return
,
2088 std::map
<std::string
, cls::rbd::MirrorImage
> *images
,
2089 std::map
<std::string
, cls::rbd::MirrorImageStatus
> *statuses
) {
2090 librados::ObjectReadOperation op
;
2091 mirror_image_status_list_start(&op
, start
, max_return
);
2094 int r
= ioctx
->operate(RBD_MIRRORING
, &op
, &out_bl
);
2099 auto iter
= out_bl
.cbegin();
2100 r
= mirror_image_status_list_finish(&iter
, images
, statuses
);
2107 void mirror_image_status_list_start(librados::ObjectReadOperation
*op
,
2108 const std::string
&start
,
2109 uint64_t max_return
) {
2112 encode(max_return
, bl
);
2113 op
->exec("rbd", "mirror_image_status_list", bl
);
2116 int mirror_image_status_list_finish(bufferlist::const_iterator
*iter
,
2117 std::map
<std::string
, cls::rbd::MirrorImage
> *images
,
2118 std::map
<std::string
, cls::rbd::MirrorImageStatus
> *statuses
) {
2122 decode(*images
, *iter
);
2123 decode(*statuses
, *iter
);
2124 } catch (const buffer::error
&err
) {
2130 int mirror_image_status_get_summary(librados::IoCtx
*ioctx
,
2131 std::map
<cls::rbd::MirrorImageStatusState
, int> *states
) {
2132 librados::ObjectReadOperation op
;
2133 mirror_image_status_get_summary_start(&op
);
2136 int r
= ioctx
->operate(RBD_MIRRORING
, &op
, &out_bl
);
2141 auto iter
= out_bl
.cbegin();
2142 r
= mirror_image_status_get_summary_finish(&iter
, states
);
2149 void mirror_image_status_get_summary_start(librados::ObjectReadOperation
*op
) {
2151 op
->exec("rbd", "mirror_image_status_get_summary", bl
);
2154 int mirror_image_status_get_summary_finish(bufferlist::const_iterator
*iter
,
2155 std::map
<cls::rbd::MirrorImageStatusState
, int> *states
) {
2157 decode(*states
, *iter
);
2158 } catch (const buffer::error
&err
) {
2164 int mirror_image_status_remove_down(librados::IoCtx
*ioctx
) {
2165 librados::ObjectWriteOperation op
;
2166 mirror_image_status_remove_down(&op
);
2167 return ioctx
->operate(RBD_MIRRORING
, &op
);
2170 void mirror_image_status_remove_down(librados::ObjectWriteOperation
*op
) {
2172 op
->exec("rbd", "mirror_image_status_remove_down", bl
);
2175 int mirror_image_instance_get(librados::IoCtx
*ioctx
,
2176 const std::string
&global_image_id
,
2177 entity_inst_t
*instance
) {
2178 librados::ObjectReadOperation op
;
2179 mirror_image_instance_get_start(&op
, global_image_id
);
2182 int r
= ioctx
->operate(RBD_MIRRORING
, &op
, &out_bl
);
2187 auto iter
= out_bl
.cbegin();
2188 r
= mirror_image_instance_get_finish(&iter
, instance
);
2195 void mirror_image_instance_get_start(librados::ObjectReadOperation
*op
,
2196 const std::string
&global_image_id
) {
2198 encode(global_image_id
, bl
);
2199 op
->exec("rbd", "mirror_image_instance_get", bl
);
2202 int mirror_image_instance_get_finish(bufferlist::const_iterator
*iter
,
2203 entity_inst_t
*instance
) {
2205 decode(*instance
, *iter
);
2206 } catch (const buffer::error
&err
) {
2212 int mirror_image_instance_list(
2213 librados::IoCtx
*ioctx
, const std::string
&start
, uint64_t max_return
,
2214 std::map
<std::string
, entity_inst_t
> *instances
) {
2215 librados::ObjectReadOperation op
;
2216 mirror_image_instance_list_start(&op
, start
, max_return
);
2219 int r
= ioctx
->operate(RBD_MIRRORING
, &op
, &out_bl
);
2224 auto iter
= out_bl
.cbegin();
2225 r
= mirror_image_instance_list_finish(&iter
, instances
);
2232 void mirror_image_instance_list_start(librados::ObjectReadOperation
*op
,
2233 const std::string
&start
,
2234 uint64_t max_return
) {
2237 encode(max_return
, bl
);
2238 op
->exec("rbd", "mirror_image_instance_list", bl
);
2241 int mirror_image_instance_list_finish(
2242 bufferlist::const_iterator
*iter
,
2243 std::map
<std::string
, entity_inst_t
> *instances
) {
2246 decode(*instances
, *iter
);
2247 } catch (const buffer::error
&err
) {
2253 void mirror_instances_list_start(librados::ObjectReadOperation
*op
) {
2255 op
->exec("rbd", "mirror_instances_list", bl
);
2258 int mirror_instances_list_finish(bufferlist::const_iterator
*iter
,
2259 std::vector
<std::string
> *instance_ids
) {
2260 instance_ids
->clear();
2262 decode(*instance_ids
, *iter
);
2263 } catch (const buffer::error
&err
) {
2269 int mirror_instances_list(librados::IoCtx
*ioctx
,
2270 std::vector
<std::string
> *instance_ids
) {
2271 librados::ObjectReadOperation op
;
2272 mirror_instances_list_start(&op
);
2275 int r
= ioctx
->operate(RBD_MIRROR_LEADER
, &op
, &out_bl
);
2280 auto iter
= out_bl
.cbegin();
2281 r
= mirror_instances_list_finish(&iter
, instance_ids
);
2288 void mirror_instances_add(librados::ObjectWriteOperation
*op
,
2289 const std::string
&instance_id
) {
2291 encode(instance_id
, bl
);
2292 op
->exec("rbd", "mirror_instances_add", bl
);
2295 int mirror_instances_add(librados::IoCtx
*ioctx
,
2296 const std::string
&instance_id
) {
2297 librados::ObjectWriteOperation op
;
2298 mirror_instances_add(&op
, instance_id
);
2299 return ioctx
->operate(RBD_MIRROR_LEADER
, &op
);
2302 void mirror_instances_remove(librados::ObjectWriteOperation
*op
,
2303 const std::string
&instance_id
) {
2305 encode(instance_id
, bl
);
2306 op
->exec("rbd", "mirror_instances_remove", bl
);
2309 int mirror_instances_remove(librados::IoCtx
*ioctx
,
2310 const std::string
&instance_id
) {
2311 librados::ObjectWriteOperation op
;
2312 mirror_instances_remove(&op
, instance_id
);
2313 return ioctx
->operate(RBD_MIRROR_LEADER
, &op
);
2316 void mirror_image_map_list_start(librados::ObjectReadOperation
*op
,
2317 const std::string
&start_after
,
2318 uint64_t max_read
) {
2320 encode(start_after
, bl
);
2321 encode(max_read
, bl
);
2323 op
->exec("rbd", "mirror_image_map_list", bl
);
2326 int mirror_image_map_list_finish(bufferlist::const_iterator
*iter
,
2327 std::map
<std::string
, cls::rbd::MirrorImageMap
> *image_mapping
) {
2329 decode(*image_mapping
, *iter
);
2330 } catch (const buffer::error
&err
) {
2336 int mirror_image_map_list(
2337 librados::IoCtx
*ioctx
, const std::string
&start_after
,
2339 std::map
<std::string
, cls::rbd::MirrorImageMap
> *image_mapping
) {
2340 librados::ObjectReadOperation op
;
2341 mirror_image_map_list_start(&op
, start_after
, max_read
);
2344 int r
= ioctx
->operate(RBD_MIRRORING
, &op
, &out_bl
);
2349 auto iter
= out_bl
.cbegin();
2350 return mirror_image_map_list_finish(&iter
, image_mapping
);
2353 void mirror_image_map_update(librados::ObjectWriteOperation
*op
,
2354 const std::string
&global_image_id
,
2355 const cls::rbd::MirrorImageMap
&image_map
) {
2357 encode(global_image_id
, bl
);
2358 encode(image_map
, bl
);
2360 op
->exec("rbd", "mirror_image_map_update", bl
);
2363 void mirror_image_map_remove(librados::ObjectWriteOperation
*op
,
2364 const std::string
&global_image_id
) {
2366 encode(global_image_id
, bl
);
2368 op
->exec("rbd", "mirror_image_map_remove", bl
);
2372 int group_dir_list(librados::IoCtx
*ioctx
, const std::string
&oid
,
2373 const std::string
&start
, uint64_t max_return
,
2374 map
<string
, string
> *cgs
)
2378 encode(max_return
, in
);
2379 int r
= ioctx
->exec(oid
, "rbd", "group_dir_list", in
, out
);
2383 auto iter
= out
.cbegin();
2386 } catch (const buffer::error
&err
) {
2393 int group_dir_add(librados::IoCtx
*ioctx
, const std::string
&oid
,
2394 const std::string
&name
, const std::string
&id
)
2399 return ioctx
->exec(oid
, "rbd", "group_dir_add", in
, out
);
2402 int group_dir_rename(librados::IoCtx
*ioctx
, const std::string
&oid
,
2403 const std::string
&src
, const std::string
&dest
,
2404 const std::string
&id
)
2410 return ioctx
->exec(oid
, "rbd", "group_dir_rename", in
, out
);
2413 int group_dir_remove(librados::IoCtx
*ioctx
, const std::string
&oid
,
2414 const std::string
&name
, const std::string
&id
)
2419 return ioctx
->exec(oid
, "rbd", "group_dir_remove", in
, out
);
2422 int group_image_remove(librados::IoCtx
*ioctx
, const std::string
&oid
,
2423 const cls::rbd::GroupImageSpec
&spec
)
2428 return ioctx
->exec(oid
, "rbd", "group_image_remove", bl
, bl2
);
2431 int group_image_list(librados::IoCtx
*ioctx
,
2432 const std::string
&oid
,
2433 const cls::rbd::GroupImageSpec
&start
,
2434 uint64_t max_return
,
2435 std::vector
<cls::rbd::GroupImageStatus
> *images
)
2439 encode(max_return
, bl
);
2441 int r
= ioctx
->exec(oid
, "rbd", "group_image_list", bl
, bl2
);
2445 auto iter
= bl2
.cbegin();
2447 decode(*images
, iter
);
2448 } catch (const buffer::error
&err
) {
2455 int group_image_set(librados::IoCtx
*ioctx
, const std::string
&oid
,
2456 const cls::rbd::GroupImageStatus
&st
)
2461 return ioctx
->exec(oid
, "rbd", "group_image_set", bl
, bl2
);
2464 int image_group_add(librados::IoCtx
*ioctx
, const std::string
&oid
,
2465 const cls::rbd::GroupSpec
&group_spec
)
2468 encode(group_spec
, bl
);
2470 return ioctx
->exec(oid
, "rbd", "image_group_add", bl
, bl2
);
2473 int image_group_remove(librados::IoCtx
*ioctx
, const std::string
&oid
,
2474 const cls::rbd::GroupSpec
&group_spec
)
2477 encode(group_spec
, bl
);
2479 return ioctx
->exec(oid
, "rbd", "image_group_remove", bl
, bl2
);
2482 void image_group_get_start(librados::ObjectReadOperation
*op
)
2485 op
->exec("rbd", "image_group_get", in_bl
);
2488 int image_group_get_finish(bufferlist::const_iterator
*iter
,
2489 cls::rbd::GroupSpec
*group_spec
)
2492 decode(*group_spec
, *iter
);
2493 } catch (const buffer::error
&err
) {
2499 int image_group_get(librados::IoCtx
*ioctx
, const std::string
&oid
,
2500 cls::rbd::GroupSpec
*group_spec
)
2502 librados::ObjectReadOperation op
;
2503 image_group_get_start(&op
);
2506 int r
= ioctx
->operate(oid
, &op
, &out_bl
);
2511 auto iter
= out_bl
.cbegin();
2512 return image_group_get_finish(&iter
, group_spec
);
2515 int group_snap_set(librados::IoCtx
*ioctx
, const std::string
&oid
,
2516 const cls::rbd::GroupSnapshot
&snapshot
)
2519 bufferlist inbl
, outbl
;
2520 encode(snapshot
, inbl
);
2521 int r
= ioctx
->exec(oid
, "rbd", "group_snap_set", inbl
, outbl
);
2525 int group_snap_remove(librados::IoCtx
*ioctx
, const std::string
&oid
,
2526 const std::string
&snap_id
)
2529 bufferlist inbl
, outbl
;
2530 encode(snap_id
, inbl
);
2531 return ioctx
->exec(oid
, "rbd", "group_snap_remove", inbl
, outbl
);
2534 int group_snap_get_by_id(librados::IoCtx
*ioctx
, const std::string
&oid
,
2535 const std::string
&snap_id
,
2536 cls::rbd::GroupSnapshot
*snapshot
)
2540 bufferlist inbl
, outbl
;
2542 encode(snap_id
, inbl
);
2543 int r
= ioctx
->exec(oid
, "rbd", "group_snap_get_by_id", inbl
, outbl
);
2548 auto iter
= outbl
.cbegin();
2550 decode(*snapshot
, iter
);
2551 } catch (const buffer::error
&err
) {
2557 int group_snap_list(librados::IoCtx
*ioctx
, const std::string
&oid
,
2558 const cls::rbd::GroupSnapshot
&start
,
2559 uint64_t max_return
,
2560 std::vector
<cls::rbd::GroupSnapshot
> *snapshots
)
2564 bufferlist inbl
, outbl
;
2565 encode(start
, inbl
);
2566 encode(max_return
, inbl
);
2568 int r
= ioctx
->exec(oid
, "rbd", "group_snap_list", inbl
, outbl
);
2572 auto iter
= outbl
.cbegin();
2574 decode(*snapshots
, iter
);
2575 } catch (const buffer::error
&err
) {
2582 // rbd_trash functions
2583 void trash_add(librados::ObjectWriteOperation
*op
,
2584 const std::string
&id
,
2585 const cls::rbd::TrashImageSpec
&trash_spec
)
2589 encode(trash_spec
, bl
);
2590 op
->exec("rbd", "trash_add", bl
);
2593 int trash_add(librados::IoCtx
*ioctx
, const std::string
&id
,
2594 const cls::rbd::TrashImageSpec
&trash_spec
)
2596 librados::ObjectWriteOperation op
;
2597 trash_add(&op
, id
, trash_spec
);
2599 return ioctx
->operate(RBD_TRASH
, &op
);
2602 void trash_remove(librados::ObjectWriteOperation
*op
,
2603 const std::string
&id
)
2607 op
->exec("rbd", "trash_remove", bl
);
2610 int trash_remove(librados::IoCtx
*ioctx
, const std::string
&id
)
2612 librados::ObjectWriteOperation op
;
2613 trash_remove(&op
, id
);
2615 return ioctx
->operate(RBD_TRASH
, &op
);
2618 void trash_list_start(librados::ObjectReadOperation
*op
,
2619 const std::string
&start
, uint64_t max_return
)
2623 encode(max_return
, bl
);
2624 op
->exec("rbd", "trash_list", bl
);
2627 int trash_list_finish(bufferlist::const_iterator
*it
,
2628 map
<string
, cls::rbd::TrashImageSpec
> *entries
)
2630 ceph_assert(entries
);
2633 decode(*entries
, *it
);
2634 } catch (const buffer::error
&err
) {
2641 int trash_list(librados::IoCtx
*ioctx
,
2642 const std::string
&start
, uint64_t max_return
,
2643 map
<string
, cls::rbd::TrashImageSpec
> *entries
)
2645 librados::ObjectReadOperation op
;
2646 trash_list_start(&op
, start
, max_return
);
2649 int r
= ioctx
->operate(RBD_TRASH
, &op
, &out_bl
);
2654 auto iter
= out_bl
.cbegin();
2655 return trash_list_finish(&iter
, entries
);
2658 void trash_get_start(librados::ObjectReadOperation
*op
,
2659 const std::string
&id
)
2663 op
->exec("rbd", "trash_get", bl
);
2666 int trash_get_finish(bufferlist::const_iterator
*it
,
2667 cls::rbd::TrashImageSpec
*trash_spec
) {
2668 ceph_assert(trash_spec
);
2670 decode(*trash_spec
, *it
);
2671 } catch (const buffer::error
&err
) {
2678 int trash_get(librados::IoCtx
*ioctx
, const std::string
&id
,
2679 cls::rbd::TrashImageSpec
*trash_spec
)
2681 librados::ObjectReadOperation op
;
2682 trash_get_start(&op
, id
);
2685 int r
= ioctx
->operate(RBD_TRASH
, &op
, &out_bl
);
2690 auto it
= out_bl
.cbegin();
2691 return trash_get_finish(&it
, trash_spec
);
2694 void trash_state_set(librados::ObjectWriteOperation
*op
,
2695 const std::string
&id
,
2696 const cls::rbd::TrashImageState
&trash_state
,
2697 const cls::rbd::TrashImageState
&expect_state
)
2701 encode(trash_state
, bl
);
2702 encode(expect_state
, bl
);
2703 op
->exec("rbd", "trash_state_set", bl
);
2706 int trash_state_set(librados::IoCtx
*ioctx
, const std::string
&id
,
2707 const cls::rbd::TrashImageState
&trash_state
,
2708 const cls::rbd::TrashImageState
&expect_state
)
2710 librados::ObjectWriteOperation op
;
2711 trash_state_set(&op
, id
, trash_state
, expect_state
);
2713 return ioctx
->operate(RBD_TRASH
, &op
);
2716 void namespace_add(librados::ObjectWriteOperation
*op
,
2717 const std::string
&name
)
2721 op
->exec("rbd", "namespace_add", bl
);
2724 int namespace_add(librados::IoCtx
*ioctx
, const std::string
&name
)
2726 librados::ObjectWriteOperation op
;
2727 namespace_add(&op
, name
);
2729 return ioctx
->operate(RBD_NAMESPACE
, &op
);
2732 void namespace_remove(librados::ObjectWriteOperation
*op
,
2733 const std::string
&name
)
2737 op
->exec("rbd", "namespace_remove", bl
);
2740 int namespace_remove(librados::IoCtx
*ioctx
, const std::string
&name
)
2742 librados::ObjectWriteOperation op
;
2743 namespace_remove(&op
, name
);
2745 return ioctx
->operate(RBD_NAMESPACE
, &op
);
2748 void namespace_list_start(librados::ObjectReadOperation
*op
,
2749 const std::string
&start
, uint64_t max_return
)
2753 encode(max_return
, bl
);
2754 op
->exec("rbd", "namespace_list", bl
);
2757 int namespace_list_finish(bufferlist::const_iterator
*it
,
2758 std::list
<std::string
> *entries
)
2760 ceph_assert(entries
);
2763 decode(*entries
, *it
);
2764 } catch (const buffer::error
&err
) {
2771 int namespace_list(librados::IoCtx
*ioctx
,
2772 const std::string
&start
, uint64_t max_return
,
2773 std::list
<std::string
> *entries
)
2775 librados::ObjectReadOperation op
;
2776 namespace_list_start(&op
, start
, max_return
);
2779 int r
= ioctx
->operate(RBD_NAMESPACE
, &op
, &out_bl
);
2784 auto iter
= out_bl
.cbegin();
2785 return namespace_list_finish(&iter
, entries
);
2788 void sparsify(librados::ObjectWriteOperation
*op
, size_t sparse_size
,
2792 encode(sparse_size
, bl
);
2793 encode(remove_empty
, bl
);
2794 op
->exec("rbd", "sparsify", bl
);
2797 int sparsify(librados::IoCtx
*ioctx
, const std::string
&oid
, size_t sparse_size
,
2800 librados::ObjectWriteOperation op
;
2801 sparsify(&op
, sparse_size
, remove_empty
);
2803 return ioctx
->operate(oid
, &op
);
2806 } // namespace cls_client
2807 } // namespace librbd