]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
librbd: additional debug logging in support of live-migration
authorJason Dillaman <dillaman@redhat.com>
Tue, 8 Dec 2020 14:57:06 +0000 (09:57 -0500)
committerJason Dillaman <dillaman@redhat.com>
Tue, 8 Dec 2020 15:01:48 +0000 (10:01 -0500)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/deep_copy/ObjectCopyRequest.cc
src/librbd/io/ObjectRequest.cc
src/librbd/migration/OpenSourceImageRequest.cc

index 4424e09484e1326c33ec344436411dd759bda2da..35431391e4173025b05a8e6619d2720898bb2316 100644 (file)
@@ -340,6 +340,7 @@ void ObjectCopyRequest<I>::send_write_object() {
 
   librados::ObjectWriteOperation op;
   if (!m_dst_image_ctx->migration_info.empty()) {
+    ldout(m_cct, 20) << "assert_snapc_seq=" << dst_snap_seq << dendl;
     cls_client::assert_snapc_seq(&op, dst_snap_seq,
                                  cls::rbd::ASSERT_SNAPC_SEQ_GT_SNAPSET_SEQ);
   }
index 0914d08ef190603d19ed1b963e8b6cf230a0603c..00fea70d6093477492c625b49b7703471ca158f4 100644 (file)
@@ -232,7 +232,7 @@ void ObjectReadRequest<I>::read_object() {
   }
   image_locker.unlock();
 
-  ldout(image_ctx->cct, 20) << dendl;
+  ldout(image_ctx->cct, 20) << "snap_id=" << read_snap_id << dendl;
 
   neorados::ReadOp read_op;
   for (auto& extent: *this->m_extents) {
@@ -485,14 +485,16 @@ void AbstractObjectWriteRequest<I>::write_object() {
 
   neorados::WriteOp write_op;
   if (m_copyup_enabled) {
-    ldout(image_ctx->cct, 20) << "guarding write" << dendl;
     if (m_guarding_migration_write) {
+      auto snap_seq = (this->m_io_context->write_snap_context() ?
+          this->m_io_context->write_snap_context()->first : 0);
+      ldout(image_ctx->cct, 20) << "guarding write: snap_seq=" << snap_seq
+                                << dendl;
+
       cls_client::assert_snapc_seq(
-        &write_op,
-        (this->m_io_context->write_snap_context() ?
-          this->m_io_context->write_snap_context()->first : 0),
-        cls::rbd::ASSERT_SNAPC_SEQ_LE_SNAPSET_SEQ);
+        &write_op, snap_seq, cls::rbd::ASSERT_SNAPC_SEQ_LE_SNAPSET_SEQ);
     } else {
+      ldout(image_ctx->cct, 20) << "guarding write" << dendl;
       write_op.assert_exists();
     }
   }
@@ -844,7 +846,8 @@ void ObjectListSnapsRequest<I>::handle_list_snaps(int r) {
                    << "clone_end_snap_id=" << clone_end_snap_id << ", "
                    << "diff=" << diff << ", "
                    << "end_size=" << end_size << ", "
-                   << "exists=" << exists << dendl;
+                   << "exists=" << exists << ", "
+                   << "whole_object=" << read_whole_object << dendl;
     if (end_snap_id <= first_snap_id) {
       // don't include deltas from the starting snapshots, but we iterate over
       // it to track its existence and size
index e19739b5e11fefa6d36149a202695eaf6475636c..8abdedf332d9922886e15b010300acc88e8f4cac 100644 (file)
@@ -41,7 +41,7 @@ void OpenSourceImageRequest<I>::open_source() {
   ldout(m_cct, 10) << dendl;
 
   // note that all source image ctx properties are placeholders
-  *m_src_image_ctx = I::create("", "", m_src_snap_id, m_io_ctx, true);
+  *m_src_image_ctx = I::create("", "", CEPH_NOSNAP, m_io_ctx, true);
   auto src_image_ctx = *m_src_image_ctx;
   src_image_ctx->child = m_dst_image_ctx;
 
@@ -63,6 +63,10 @@ void OpenSourceImageRequest<I>::open_source() {
     import_only = false;
   }
 
+  ldout(m_cct, 15) << "source_spec=" << source_spec << ", "
+                   << "source_snap_id=" << m_src_snap_id << ", "
+                   << "import_only=" << import_only << dendl;
+
   SourceSpecBuilder<I> source_spec_builder{src_image_ctx};
   json_spirit::mObject source_spec_object;
   int r = source_spec_builder.parse_source_spec(source_spec,
@@ -169,6 +173,9 @@ void OpenSourceImageRequest<I>::handle_get_snapshots(int r) {
     auto& [snap_id, snap_info] = *it;
     snapc.snaps.push_back(snap_id);
 
+    ldout(m_cct, 10) << "adding snap: ns=" << snap_info.snap_namespace << ", "
+                     << "name=" << snap_info.name << ", "
+                     << "id=" << snap_id << dendl;
     src_image_ctx->add_snap(
       snap_info.snap_namespace, snap_info.name, snap_id,
       snap_info.size, snap_info.parent, snap_info.protection_status,
@@ -179,11 +186,22 @@ void OpenSourceImageRequest<I>::handle_get_snapshots(int r) {
   }
   src_image_ctx->snapc = snapc;
 
+  ldout(m_cct, 15) << "read snap id: " << m_src_snap_id << ", "
+                   << "write snapc={"
+                   << "seq=" << snapc.seq << ", "
+                   << "snaps=" << snapc.snaps << "}" << dendl;
+
   // ensure data_ctx and data_io_context are pointing to correct snapshot
-  if (src_image_ctx->open_snap_id != CEPH_NOSNAP) {
-    int r = src_image_ctx->snap_set(src_image_ctx->open_snap_id);
-    ceph_assert(r == 0);
-    src_image_ctx->open_snap_id = CEPH_NOSNAP;
+  if (m_src_snap_id != CEPH_NOSNAP) {
+    int r = src_image_ctx->snap_set(m_src_snap_id);
+    if (r < 0) {
+      src_image_ctx->image_lock.unlock();
+
+      lderr(m_cct) << "error setting source image snap id: "
+                   << cpp_strerror(r) << dendl;
+      finish(r);
+      return;
+    }
   }
 
   src_image_ctx->image_lock.unlock();