1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef CEPH_LIBRBD_MIRROR_SNAPSHOT_CREATE_NON_PRIMARY_REQUEST_H
5 #define CEPH_LIBRBD_MIRROR_SNAPSHOT_CREATE_NON_PRIMARY_REQUEST_H
7 #include "include/buffer.h"
8 #include "cls/rbd/cls_rbd_types.h"
9 #include "librbd/Types.h"
10 #include "librbd/internal.h"
11 #include "librbd/mirror/snapshot/Types.h"
25 template <typename ImageCtxT
= librbd::ImageCtx
>
26 class CreateNonPrimaryRequest
{
28 static CreateNonPrimaryRequest
*create(ImageCtxT
*image_ctx
,
30 const std::string
&primary_mirror_uuid
,
31 uint64_t primary_snap_id
,
32 const SnapSeqs
& snap_seqs
,
33 const ImageState
&image_state
,
36 return new CreateNonPrimaryRequest(image_ctx
, demoted
, primary_mirror_uuid
,
37 primary_snap_id
, snap_seqs
, image_state
,
41 CreateNonPrimaryRequest(ImageCtxT
*image_ctx
,
43 const std::string
&primary_mirror_uuid
,
44 uint64_t primary_snap_id
,
45 const SnapSeqs
& snap_seqs
,
46 const ImageState
&image_state
, uint64_t *snap_id
,
63 * v (skip if not needed)
78 ImageCtxT
*m_image_ctx
;
80 std::string m_primary_mirror_uuid
;
81 uint64_t m_primary_snap_id
;
83 ImageState m_image_state
;
87 librados::IoCtx m_default_ns_ctx
;
88 std::set
<std::string
> m_mirror_peer_uuids
;
90 std::string m_snap_name
;
93 NoOpProgressContext m_prog_ctx
;
95 bool is_orphan() const {
96 return m_primary_mirror_uuid
.empty();
100 void handle_refresh_image(int r
);
102 void get_mirror_image();
103 void handle_get_mirror_image(int r
);
105 void get_mirror_peers();
106 void handle_get_mirror_peers(int r
);
108 void create_snapshot();
109 void handle_create_snapshot(int r
);
111 void write_image_state();
112 void handle_write_image_state(int r
);
117 } // namespace snapshot
118 } // namespace mirror
119 } // namespace librbd
121 extern template class librbd::mirror::snapshot::CreateNonPrimaryRequest
<librbd::ImageCtx
>;
123 #endif // CEPH_LIBRBD_MIRROR_SNAPSHOT_CREATE_NON_PRIMARY_REQUEST_H