]> git.proxmox.com Git - ceph.git/blame - ceph/src/librbd/api/Mirror.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / librbd / api / Mirror.h
CommitLineData
7c673cae
FG
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
3
4#ifndef LIBRBD_API_MIRROR_H
5#define LIBRBD_API_MIRROR_H
6
7#include "include/rbd/librbd.hpp"
8#include <map>
9#include <string>
10#include <vector>
11
12struct Context;
13
14namespace librbd {
15
16struct ImageCtx;
17
18namespace api {
19
20template <typename ImageCtxT = librbd::ImageCtx>
21struct Mirror {
11fdf7f2 22 typedef std::map<std::string, std::string> Attributes;
7c673cae
FG
23 typedef std::map<std::string, mirror_image_status_t> IdToMirrorImageStatus;
24 typedef std::map<mirror_image_status_state_t, int> MirrorImageStatusStates;
25
26 static int mode_get(librados::IoCtx& io_ctx, rbd_mirror_mode_t *mirror_mode);
27 static int mode_set(librados::IoCtx& io_ctx, rbd_mirror_mode_t mirror_mode);
28
29 static int peer_add(librados::IoCtx& io_ctx, std::string *uuid,
30 const std::string &cluster_name,
31 const std::string &client_name);
32 static int peer_remove(librados::IoCtx& io_ctx, const std::string &uuid);
33 static int peer_list(librados::IoCtx& io_ctx,
34 std::vector<mirror_peer_t> *peers);
35 static int peer_set_client(librados::IoCtx& io_ctx, const std::string &uuid,
36 const std::string &client_name);
37 static int peer_set_cluster(librados::IoCtx& io_ctx, const std::string &uuid,
38 const std::string &cluster_name);
11fdf7f2
TL
39 static int peer_get_attributes(librados::IoCtx& io_ctx,
40 const std::string &uuid,
41 Attributes* attributes);
42 static int peer_set_attributes(librados::IoCtx& io_ctx,
43 const std::string &uuid,
44 const Attributes& attributes);
7c673cae
FG
45
46 static int image_status_list(librados::IoCtx& io_ctx,
47 const std::string &start_id, size_t max,
48 IdToMirrorImageStatus *images);
49 static int image_status_summary(librados::IoCtx& io_ctx,
50 MirrorImageStatusStates *states);
11fdf7f2
TL
51 static int image_instance_id_list(librados::IoCtx& io_ctx,
52 const std::string &start_image_id,
53 size_t max,
54 std::map<std::string, std::string> *ids);
7c673cae
FG
55
56 static int image_enable(ImageCtxT *ictx, bool relax_same_pool_parent_check);
57 static int image_disable(ImageCtxT *ictx, bool force);
58 static int image_promote(ImageCtxT *ictx, bool force);
59 static void image_promote(ImageCtxT *ictx, bool force, Context *on_finish);
60 static int image_demote(ImageCtxT *ictx);
61 static void image_demote(ImageCtxT *ictx, Context *on_finish);
62 static int image_resync(ImageCtxT *ictx);
63 static int image_get_info(ImageCtxT *ictx,
11fdf7f2 64 mirror_image_info_t *mirror_image_info);
7c673cae
FG
65 static void image_get_info(ImageCtxT *ictx,
66 mirror_image_info_t *mirror_image_info,
11fdf7f2
TL
67 Context *on_finish);
68 static int image_get_status(ImageCtxT *ictx, mirror_image_status_t *status);
7c673cae 69 static void image_get_status(ImageCtxT *ictx, mirror_image_status_t *status,
11fdf7f2
TL
70 Context *on_finish);
71 static int image_get_instance_id(ImageCtxT *ictx, std::string *instance_id);
7c673cae
FG
72};
73
74} // namespace api
75} // namespace librbd
76
77extern template class librbd::api::Mirror<librbd::ImageCtx>;
78
79#endif // LIBRBD_API_MIRROR_H