]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge pull request #9207 from rjfd/wip-15670
authorJason Dillaman <dillaman@redhat.com>
Wed, 22 Jun 2016 22:03:22 +0000 (18:03 -0400)
committerGitHub <noreply@github.com>
Wed, 22 Jun 2016 22:03:22 +0000 (18:03 -0400)
rbd-mirror: image resync

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
1  2 
qa/workunits/rbd/rbd_mirror_helpers.sh
src/journal/JournalMetadata.cc
src/librbd/Journal.cc
src/librbd/Journal.h
src/librbd/journal/Types.h
src/tools/rbd_mirror/ImageReplayer.cc
src/tools/rbd_mirror/ImageReplayer.h

Simple merge
Simple merge
index 083aef564ae1eb31c9d2dc79171fbd061b60e1ce,c5cee0f3f2cf081d0c5c4d5ac8f44e40bf629004..7f085dfc6c4ab3314267a04d032d983996cb994c
@@@ -155,9 -156,16 +156,16 @@@ public
    }
  
    void start_external_replay(journal::Replay<ImageCtxT> **journal_replay,
 -                             Context *on_finish);
 +                             Context *on_start, Context *on_close_request);
    void stop_external_replay();
  
+   void add_listener(journal::ListenerType type,
+                     journal::JournalListenerPtr listener);
+   void remove_listener(journal::ListenerType type,
+                        journal::JournalListenerPtr listener);
+   int check_resync_requested(bool *do_resync);
  private:
    ImageCtxT &m_image_ctx;
  
    bool m_blocking_writes;
  
    journal::Replay<ImageCtxT> *m_journal_replay;
 +  Context *m_on_replay_close_request = nullptr;
  
+   struct MetadataListener : public ::journal::JournalMetadataListener {
+     Journal<ImageCtxT> *journal;
+     MetadataListener(Journal<ImageCtxT> *journal) : journal(journal) { }
+     void handle_update(::journal::JournalMetadata *) {
+       FunctionContext *ctx = new FunctionContext([this](int r) {
+         journal->handle_metadata_updated();
+       });
+       journal->m_work_queue->queue(ctx, 0);
+     }
+   } m_metadata_listener;
+   typedef std::map<journal::ListenerType,
+                    std::list<journal::JournalListenerPtr> > ListenerMap;
+   ListenerMap m_listener_map;
    uint64_t append_io_events(journal::EventType event_type,
                              const Bufferlists &bufferlists,
                              const AioObjectRequests &requests,
Simple merge
index 89aef4748cebf9c2d0e0088a6a757e966a697ffc,90605f0130f5c186ba3e59659b49b23fa3865ce5..19da8882f7edb3aee6f95e1a9f38aef42a9e0cff
@@@ -525,22 -552,8 +567,21 @@@ void ImageReplayer<I>::handle_start_rep
      dout(20) << "m_remote_journaler=" << *m_remote_journaler << dendl;
    }
  
-   on_replay_interrupted();
  }
  
 +template <typename I>
 +void ImageReplayer<I>::handle_stop_replay_request(int r) {
 +  if (r < 0) {
 +    // error starting or we requested the stop -- ignore
 +    return;
 +  }
 +
 +  // journal close has been requested, stop replay so the journal
 +  // can be closed (since it will wait on replay to finish)
 +  dout(20) << dendl;
 +  on_stop_journal_replay();
 +}
 +
  template <typename I>
  void ImageReplayer<I>::on_start_fail(int r, const std::string &desc)
  {
index df8488845446fffa0a2b0091f563a45712be16a8,8ae79afdd6c4bb914cd5e35adff606d6ec545c4c..5d2a9a4ce5c645643277fd61e1161d67f7418ee7
  #include "cls/journal/cls_journal_types.h"
  #include "cls/rbd/cls_rbd_types.h"
  #include "journal/ReplayEntry.h"
 +#include "librbd/ImageCtx.h"
  #include "librbd/journal/Types.h"
  #include "librbd/journal/TypeTraits.h"
+ #include "ImageDeleter.h"
  #include "ProgressContext.h"
  #include "types.h"
  #include <boost/optional.hpp>