]> git.proxmox.com Git - ceph.git/blame - ceph/src/librbd/image/DetachParentRequest.h
import ceph quincy 17.2.1
[ceph.git] / ceph / src / librbd / image / DetachParentRequest.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_DETACH_PARENT_REQUEST_H
5#define CEPH_LIBRBD_IMAGE_DETACH_PARENT_REQUEST_H
6
7#include "include/int_types.h"
8#include "include/buffer.h"
9#include "include/rados/librados.hpp"
10#include "librbd/Types.h"
11
12class Context;
13
14namespace librbd {
15
16class ImageCtx;
17
18namespace image {
19
20template <typename ImageCtxT = ImageCtx>
21class DetachParentRequest {
22public:
23 static DetachParentRequest* create(ImageCtxT& image_ctx, Context* on_finish) {
24 return new DetachParentRequest(image_ctx, on_finish);
25 }
26
27 DetachParentRequest(ImageCtxT& image_ctx, Context* on_finish)
28 : m_image_ctx(image_ctx), m_on_finish(on_finish) {
29 }
30
31 void send();
32
33private:
34 /**
35 * @verbatim
36 *
37 * <start>
38 * | * * * * * *
39 * | * * -EOPNOTSUPP
40 * v v *
41 * DETACH_PARENT * * *
42 * |
43 * v
44 * <finish>
45 *
46 * @endverbatim
47 */
48
49 ImageCtxT& m_image_ctx;
50 Context* m_on_finish;
51
52 bool m_legacy_parent = false;
53
54 void detach_parent();
55 void handle_detach_parent(int r);
56
57 void finish(int r);
58
59};
60
61} // namespace image
62} // namespace librbd
63
64extern template class librbd::image::DetachParentRequest<librbd::ImageCtx>;
65
66#endif // CEPH_LIBRBD_IMAGE_DETACH_PARENT_REQUEST_H