]> 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>
Thu, 11 Aug 2016 15:28:19 +0000 (11:28 -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>
(cherry picked from commit 58ed8a18e91401333bc3f3f957ce5d715b6687b6)

src/test/rbd_mirror/image_sync/test_mock_ImageCopyRequest.cc
src/tools/rbd_mirror/image_sync/ImageCopyRequest.cc

index 1c0241ff93ea963bf027f9e984f719d77ac378af..3d0855f31af72d0bf3b79848c8e521561d862ff2 100644 (file)
@@ -596,6 +596,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 14c75cd6751c5fc6eab76c3faaf6705ec50d65a1..336f114c41e4083ff1ad0b41aecedc8a0cee4879 100644 (file)
@@ -41,7 +41,6 @@ ImageCopyRequest<I>::ImageCopyRequest(I *local_image_ctx, I *remote_image_ctx,
     m_update_sync_point_interval(g_ceph_context->_conf->rbd_mirror_sync_point_update_age),
     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>