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