]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: permit opening local image in snapshot-based mode
authorJason Dillaman <dillaman@redhat.com>
Thu, 30 Jan 2020 19:32:37 +0000 (14:32 -0500)
committerJason Dillaman <dillaman@redhat.com>
Thu, 30 Jan 2020 19:38:04 +0000 (14:38 -0500)
Drop the temporary test to ensure the image was in journal mode.
Also ignore missing exclusive lock feature when in snapshot
mode.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/tools/rbd_mirror/image_replayer/OpenLocalImageRequest.cc

index a027152024479bcda46cb0dc59a693f248626016..6606a5009e159df0f3c0390158abc35384887e3e 100644 (file)
@@ -184,13 +184,6 @@ void OpenLocalImageRequest<I>::handle_get_mirror_info(int r) {
     return;
   }
 
-  if (m_mirror_image.mode != cls::rbd::MIRROR_IMAGE_MODE_JOURNAL) {
-    dout(5) << ": local image is in unsupported mode: " << m_mirror_image.mode
-            << dendl;
-    send_close_image(-EOPNOTSUPP);
-    return;
-  }
-
   // if the local image owns the tag -- don't steal the lock since
   // we aren't going to mirror peer data into this image anyway
   if (m_promotion_state == librbd::mirror::PROMOTION_STATE_PRIMARY) {
@@ -204,15 +197,20 @@ void OpenLocalImageRequest<I>::handle_get_mirror_info(int r) {
 
 template <typename I>
 void OpenLocalImageRequest<I>::send_lock_image() {
-  dout(20) << dendl;
-
   std::shared_lock owner_locker{(*m_local_image_ctx)->owner_lock};
   if ((*m_local_image_ctx)->exclusive_lock == nullptr) {
-    derr << ": image does not support exclusive lock" << dendl;
-    send_close_image(-EINVAL);
+    owner_locker.unlock();
+    if (m_mirror_image.mode == cls::rbd::MIRROR_IMAGE_MODE_SNAPSHOT) {
+      finish(0);
+    } else {
+      derr << ": image does not support exclusive lock" << dendl;
+      send_close_image(-EINVAL);
+    }
     return;
   }
 
+  dout(20) << dendl;
+
   // disallow any proxied maintenance operations before grabbing lock
   (*m_local_image_ctx)->exclusive_lock->block_requests(-EROFS);