]> git.proxmox.com Git - ceph.git/blob - ceph/src/librbd/image/ValidatePoolRequest.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / librbd / image / ValidatePoolRequest.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #ifndef CEPH_LIBRBD_IMAGE_VALIDATE_POOL_REQUEST_H
5 #define CEPH_LIBRBD_IMAGE_VALIDATE_POOL_REQUEST_H
6
7 #include "include/common_fwd.h"
8 #include "include/rados/librados.hpp"
9 #include "include/buffer.h"
10
11 class Context;
12 class ContextWQ;
13
14 namespace librbd {
15
16 struct ImageCtx;
17
18 namespace image {
19
20 template <typename ImageCtxT>
21 class ValidatePoolRequest {
22 public:
23 static ValidatePoolRequest* create(librados::IoCtx& io_ctx,
24 ContextWQ *op_work_queue,
25 Context *on_finish) {
26 return new ValidatePoolRequest(io_ctx, op_work_queue, on_finish);
27 }
28
29 ValidatePoolRequest(librados::IoCtx& io_ctx, ContextWQ *op_work_queue,
30 Context *on_finish);
31
32 void send();
33
34 private:
35 /**
36 * @verbatim
37 *
38 * <start>
39 * |
40 * v (overwrites validated)
41 * READ RBD INFO . . . . . . . . .
42 * | . .
43 * | . (snapshots validated) .
44 * | . . . . . . . . . . .
45 * v . .
46 * CREATE SNAPSHOT . .
47 * | . .
48 * v . .
49 * WRITE RBD INFO . .
50 * | . .
51 * v . .
52 * REMOVE SNAPSHOT . .
53 * | . .
54 * v . .
55 * OVERWRITE RBD INFO < . . . .
56 * | .
57 * v .
58 * <finish> < . . . . . . . . . .`
59 *
60 * @endverbatim
61 */
62
63 librados::IoCtx m_io_ctx;
64 CephContext* m_cct;
65 ContextWQ* m_op_work_queue;
66 Context* m_on_finish;
67
68 int m_ret_val = 0;
69 bufferlist m_out_bl;
70 uint64_t m_snap_id = 0;
71
72 void read_rbd_info();
73 void handle_read_rbd_info(int r);
74
75 void create_snapshot();
76 void handle_create_snapshot(int r);
77
78 void write_rbd_info();
79 void handle_write_rbd_info(int r);
80
81 void remove_snapshot();
82 void handle_remove_snapshot(int r);
83
84 void overwrite_rbd_info();
85 void handle_overwrite_rbd_info(int r);
86
87 void finish(int r);
88
89 };
90
91 } // namespace image
92 } // namespace librbd
93
94 extern template class librbd::image::ValidatePoolRequest<librbd::ImageCtx>;
95
96 #endif // CEPH_LIBRBD_IMAGE_VALIDATE_POOL_REQUEST_H