]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd/migration: initialize default source image layout
authorJason Dillaman <dillaman@redhat.com>
Tue, 27 Oct 2020 15:27:33 +0000 (11:27 -0400)
committerJason Dillaman <dillaman@redhat.com>
Sun, 1 Nov 2020 14:22:38 +0000 (09:22 -0500)
For backing source formats that don't care about the low-level
RBD layout details, provide safe default values for the layout
to ensure that striping logic will still function.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/migration/OpenSourceImageRequest.cc

index f12d7cb518f5221d72d8e64e62fb8de3ab2ddd19..eb480644426dd3f2c47ac09143ef4eb55910d60e 100644 (file)
@@ -43,7 +43,16 @@ void OpenSourceImageRequest<I>::open_source() {
   // note that all source image ctx properties are placeholders
   *m_src_image_ctx = I::create("", "", m_src_snap_id, m_dst_image_ctx->md_ctx,
                                true);
-  (*m_src_image_ctx)->child = m_dst_image_ctx;
+  auto src_image_ctx = *m_src_image_ctx;
+  src_image_ctx->child = m_dst_image_ctx;
+
+  // use default layout values (can be overridden by source layers later)
+  src_image_ctx->order = 22;
+  src_image_ctx->layout = file_layout_t();
+  src_image_ctx->layout.stripe_count = 1;
+  src_image_ctx->layout.stripe_unit = 1ULL << src_image_ctx->order;
+  src_image_ctx->layout.object_size = 1Ull << src_image_ctx->order;
+  src_image_ctx->layout.pool_id = -1;
 
   auto source_spec = m_migration_info.source_spec;
   if (source_spec.empty()) {
@@ -53,7 +62,7 @@ void OpenSourceImageRequest<I>::open_source() {
       m_migration_info.image_name, m_migration_info.image_id);
   }
 
-  SourceSpecBuilder<I> source_spec_builder{*m_src_image_ctx};
+  SourceSpecBuilder<I> source_spec_builder{src_image_ctx};
   json_spirit::mObject source_spec_object;
   int r = source_spec_builder.parse_source_spec(source_spec,
                                                 &source_spec_object);