From 1ee644d97104c9caaa83918b98b388888fc5497b Mon Sep 17 00:00:00 2001 From: Or Ozeri Date: Tue, 31 Jan 2023 13:08:22 +0200 Subject: [PATCH] librbd/migration: don't clone when flattening When the flatten flag is set, instead of creating the destination image by cloning, create it independently, as the parent relation is unnecessary in this case. This will be particularly useful when the migration source is located in an external Ceph cluster, which will soon be supported. Signed-off-by: Or Ozeri Signed-off-by: Ilya Dryomov --- src/librbd/api/Migration.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librbd/api/Migration.cc b/src/librbd/api/Migration.cc index 934e7be3b8f5a..67b9028caeb22 100644 --- a/src/librbd/api/Migration.cc +++ b/src/librbd/api/Migration.cc @@ -1485,7 +1485,7 @@ int Migration::create_dst_image(I** image_ctx) { int r; C_SaferCond on_create; librados::IoCtx parent_io_ctx; - if (parent_spec.pool_id == -1) { + if (parent_spec.pool_id == -1 || m_flatten) { auto *req = image::CreateRequest::create( config, m_dst_io_ctx, m_dst_image_name, m_dst_image_id, size, m_image_options, image::CREATE_FLAG_SKIP_MIRROR_ENABLE, -- 2.39.5