Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / librbd / image / SetFlagsRequest.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_SET_FLAGS_REQUEST_H
5 #define CEPH_LIBRBD_IMAGE_SET_FLAGS_REQUEST_H
6
7 #include "include/buffer.h"
8 #include "common/Mutex.h"
9 #include <map>
10 #include <string>
11
12 class Context;
13
14 namespace librbd {
15
16 class ImageCtx;
17
18 namespace image {
19
20 template <typename ImageCtxT = ImageCtx>
21 class SetFlagsRequest {
22 public:
23   static SetFlagsRequest *create(ImageCtxT *image_ctx, uint64_t flags,
24                                  uint64_t mask, Context *on_finish) {
25     return new SetFlagsRequest(image_ctx, flags, mask, on_finish);
26   }
27
28   void send();
29
30 private:
31   /**
32    * @verbatim
33    *
34    * <start>
35    *    |   .  .  .
36    *    v   v     .
37    * SET_FLAGS    . (for every snapshot)
38    *    |   .     .
39    *    v   .  .  .
40    * <finis>
41    *
42    * @endverbatim
43    */
44
45   SetFlagsRequest(ImageCtxT *image_ctx, uint64_t flags, uint64_t mask,
46                   Context *on_finish);
47
48   ImageCtxT *m_image_ctx;
49   uint64_t m_flags;
50   uint64_t m_mask;
51   Context *m_on_finish;
52
53   void send_set_flags();
54   Context *handle_set_flags(int *result);
55 };
56
57 } // namespace image
58 } // namespace librbd
59
60 extern template class librbd::image::SetFlagsRequest<librbd::ImageCtx>;
61
62 #endif // CEPH_LIBRBD_IMAGE_SET_FLAGS_REQUEST_H