summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Dillaman <dillaman@redhat.com>2020-10-27 02:25:02 +0100
committerJason Dillaman <dillaman@redhat.com>2020-11-01 15:22:38 +0100
commit9ad4d7936afcc1da3d032f5486b856e932d04a4d (patch)
treeaa9debf1dc4011c1d267a083bd5d3453419b1365
parentlibrbd: added new 'migration_prepare_import' API methods (diff)
downloadceph-9ad4d7936afcc1da3d032f5486b856e932d04a4d.tar.xz
ceph-9ad4d7936afcc1da3d032f5486b856e932d04a4d.zip
librbd/migration: fix issue with prepare-import and native-format
When preparing an import, the native format can not expect to have the child image opened since it hasn't been created yet. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
-rw-r--r--src/librbd/migration/NativeFormat.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/librbd/migration/NativeFormat.cc b/src/librbd/migration/NativeFormat.cc
index b6046d0d2d1..cb3b5164abb 100644
--- a/src/librbd/migration/NativeFormat.cc
+++ b/src/librbd/migration/NativeFormat.cc
@@ -109,11 +109,13 @@ void NativeFormat<I>::open(Context* on_finish) {
m_image_ctx->id = m_image_id;
}
- // set rados flags for reading the parent image
- if (m_image_ctx->child->config.template get_val<bool>("rbd_balance_parent_reads")) {
- m_image_ctx->set_read_flag(librados::OPERATION_BALANCE_READS);
- } else if (m_image_ctx->child->config.template get_val<bool>("rbd_localize_parent_reads")) {
- m_image_ctx->set_read_flag(librados::OPERATION_LOCALIZE_READS);
+ if (m_image_ctx->child != nullptr) {
+ // set rados flags for reading the parent image
+ if (m_image_ctx->child->config.template get_val<bool>("rbd_balance_parent_reads")) {
+ m_image_ctx->set_read_flag(librados::OPERATION_BALANCE_READS);
+ } else if (m_image_ctx->child->config.template get_val<bool>("rbd_localize_parent_reads")) {
+ m_image_ctx->set_read_flag(librados::OPERATION_LOCALIZE_READS);
+ }
}
// open the source RBD image