1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef LIBRBD_API_MIRROR_H
5 #define LIBRBD_API_MIRROR_H
7 #include "include/rbd/librbd.hpp"
20 template <typename ImageCtxT = librbd::ImageCtx>
22 typedef std::map<std::string, mirror_image_status_t> IdToMirrorImageStatus;
23 typedef std::map<mirror_image_status_state_t, int> MirrorImageStatusStates;
25 static int mode_get(librados::IoCtx& io_ctx, rbd_mirror_mode_t *mirror_mode);
26 static int mode_set(librados::IoCtx& io_ctx, rbd_mirror_mode_t mirror_mode);
28 static int peer_add(librados::IoCtx& io_ctx, std::string *uuid,
29 const std::string &cluster_name,
30 const std::string &client_name);
31 static int peer_remove(librados::IoCtx& io_ctx, const std::string &uuid);
32 static int peer_list(librados::IoCtx& io_ctx,
33 std::vector<mirror_peer_t> *peers);
34 static int peer_set_client(librados::IoCtx& io_ctx, const std::string &uuid,
35 const std::string &client_name);
36 static int peer_set_cluster(librados::IoCtx& io_ctx, const std::string &uuid,
37 const std::string &cluster_name);
39 static int image_status_list(librados::IoCtx& io_ctx,
40 const std::string &start_id, size_t max,
41 IdToMirrorImageStatus *images);
42 static int image_status_summary(librados::IoCtx& io_ctx,
43 MirrorImageStatusStates *states);
45 static int image_enable(ImageCtxT *ictx, bool relax_same_pool_parent_check);
46 static int image_disable(ImageCtxT *ictx, bool force);
47 static int image_promote(ImageCtxT *ictx, bool force);
48 static void image_promote(ImageCtxT *ictx, bool force, Context *on_finish);
49 static int image_demote(ImageCtxT *ictx);
50 static void image_demote(ImageCtxT *ictx, Context *on_finish);
51 static int image_resync(ImageCtxT *ictx);
52 static int image_get_info(ImageCtxT *ictx,
53 mirror_image_info_t *mirror_image_info,
55 static void image_get_info(ImageCtxT *ictx,
56 mirror_image_info_t *mirror_image_info,
57 size_t info_size, Context *on_finish);
58 static int image_get_status(ImageCtxT *ictx, mirror_image_status_t *status,
60 static void image_get_status(ImageCtxT *ictx, mirror_image_status_t *status,
61 size_t status_size, Context *on_finish);
68 extern template class librbd::api::Mirror<librbd::ImageCtx>;
70 #endif // LIBRBD_API_MIRROR_H