]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/librbd/mirror/DisableRequest.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / librbd / mirror / DisableRequest.h
index 1a3b122339c8c8e7a7693c0d948a8dd127cbf0a9..f45d1a14cee7d5b52a91c8c218876411df54ebf7 100644 (file)
@@ -5,9 +5,11 @@
 #define CEPH_LIBRBD_MIRROR_DISABLE_REQUEST_H
 
 #include "include/buffer.h"
-#include "common/Mutex.h"
+#include "common/ceph_mutex.h"
 #include "cls/journal/cls_journal_types.h"
 #include "cls/rbd/cls_rbd_types.h"
+#include "librbd/mirror/Types.h"
+
 #include <map>
 #include <string>
 
@@ -39,19 +41,16 @@ private:
    * <start>
    *    |
    *    v
-   * GET_MIRROR_IMAGE * * * * * * * * * * * * * * * * * * * * * * *
-   *    |                                                         *
-   *    v                                                         *
-   * GET_TAG_OWNER  * * * * * * * * * * * * * * * * * * * * * * * *
+   * GET_MIRROR_INFO  * * * * * * * * * * * * * * * * * * * * * * *
    *    |                                                         *
    *    v                                                         *
-   * SET_MIRROR_IMAGE * * * * * * * * * * * * * * * * * * * * * * *
+   * IMAGE_STATE_UPDATE * * * * * * * * * * * * * * * * * * * * * *
    *    |                                                         *
    *    v                                                         *
-   * NOTIFY_MIRRORING_WATCHER                                     *
+   * PROMOTE_IMAGE (skip if primary)                              *
    *    |                                                         *
    *    v                                                         *
-   * PROMOTE_IMAGE (skip if primary)                              *
+   * REFRESH_IMAGE (skip if necessary)                            *
    *    |                                                         *
    *    v                                                         *
    * GET_CLIENTS <----------------------------------------\ * * * *
@@ -72,9 +71,6 @@ private:
    * REMOVE_MIRROR_IMAGE  * * * * * * * * * * * * * * * * * * * * *
    *    |         (skip if no remove)                             *
    *    v                                                         *
-   * NOTIFY_MIRRORING_WATCHER_REMOVED                             *
-   *    |         (skip if not primary or no remove)              *
-   *    v                                                         *
    * <finish> < * * * * * * * * * * * * * * * * * * * * * * * * * *
    *
    * @endverbatim
@@ -86,22 +82,21 @@ private:
   Context *m_on_finish;
 
   bool m_is_primary = false;
-  bufferlist m_out_bl;
   cls::rbd::MirrorImage m_mirror_image;
+  PromotionState m_promotion_state = PROMOTION_STATE_NON_PRIMARY;
+  std::string m_primary_mirror_uuid;
   std::set<cls::journal::Client> m_clients;
   std::map<std::string, int> m_ret;
   std::map<std::string, int> m_current_ops;
   int m_error_result = 0;
-  mutable Mutex m_lock;
-
-  void send_get_mirror_image();
-  Context *handle_get_mirror_image(int *result);
+  mutable ceph::mutex m_lock =
+    ceph::make_mutex("mirror::DisableRequest::m_lock");
 
-  void send_get_tag_owner();
-  Context *handle_get_tag_owner(int *result);
+  void send_get_mirror_info();
+  Context *handle_get_mirror_info(int *result);
 
-  void send_set_mirror_image();
-  Context *handle_set_mirror_image(int *result);
+  void send_image_state_update();
+  Context *handle_image_state_update(int *result);
 
   void send_notify_mirroring_watcher();
   Context *handle_notify_mirroring_watcher(int *result);
@@ -109,9 +104,16 @@ private:
   void send_promote_image();
   Context *handle_promote_image(int *result);
 
+  void send_refresh_image();
+  Context* handle_refresh_image(int* result);
+
+  void clean_mirror_state();
+
   void send_get_clients();
   Context *handle_get_clients(int *result);
 
+  void remove_mirror_snapshots();
+
   void send_remove_snap(const std::string &client_id,
                         const cls::rbd::SnapshotNamespace &snap_namespace,
                        const std::string &snap_name);