]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: ignore empty snapshot sequence mapping
authorJason Dillaman <dillaman@redhat.com>
Wed, 15 Jun 2016 20:34:44 +0000 (16:34 -0400)
committerJason Dillaman <dillaman@redhat.com>
Wed, 15 Jun 2016 20:34:44 +0000 (16:34 -0400)
This invalid condition will be gracefully detected and handled
when the snapshot mappings are computed.

Fixes: http://tracker.ceph.com/issues/16329
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/test/rbd_mirror/image_sync/test_mock_ImageCopyRequest.cc
src/tools/rbd_mirror/image_sync/ImageCopyRequest.cc

index abc6cc03673696e616798e66eb572722eb69e242..ca6326e2fd2b016f98c9dd0bd3a790e076bff407 100644 (file)
@@ -489,6 +489,28 @@ TEST_F(TestMockImageSyncImageCopyRequest, EmptySnapMap) {
   ASSERT_EQ(-EINVAL, ctx.wait());
 }
 
+TEST_F(TestMockImageSyncImageCopyRequest, EmptySnapSeqs) {
+  ASSERT_EQ(0, create_snap("snap1"));
+  ASSERT_EQ(0, create_snap("snap2"));
+  m_client_meta.snap_seqs = {};
+  m_client_meta.sync_points = {{"snap2", "snap1", boost::none}};
+
+  librbd::MockImageCtx mock_remote_image_ctx(*m_remote_image_ctx);
+  librbd::MockImageCtx mock_local_image_ctx(*m_local_image_ctx);
+  journal::MockJournaler mock_journaler;
+
+  expect_get_snap_id(mock_remote_image_ctx);
+
+  C_SaferCond ctx;
+  MockImageCopyRequest *request = create_request(mock_remote_image_ctx,
+                                                 mock_local_image_ctx,
+                                                 mock_journaler,
+                                                 m_client_meta.sync_points.front(),
+                                                 &ctx);
+  request->send();
+  ASSERT_EQ(-EINVAL, ctx.wait());
+}
+
 } // namespace image_sync
 } // namespace mirror
 } // namespace rbd
index e037f8812608bbb553581cb8691a5dd686689e7b..e1845e4b97d246939fd16a8bb79426a8f7439da7 100644 (file)
@@ -38,7 +38,6 @@ ImageCopyRequest<I>::ImageCopyRequest(I *local_image_ctx, I *remote_image_ctx,
     m_lock(unique_lock_name("ImageCopyRequest::m_lock", this)),
     m_client_meta_copy(*client_meta) {
   assert(!m_client_meta_copy.sync_points.empty());
-  assert(!m_client_meta_copy.snap_seqs.empty());
 }
 
 template <typename I>