From 3b81f6871917b282b50d3ac412ffb69b6e66d074 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Thu, 6 Oct 2016 15:40:56 -0400 Subject: [PATCH] librbd: include pool id in data block prefix if data pool enabled Signed-off-by: Jason Dillaman --- src/librbd/image/CreateRequest.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/librbd/image/CreateRequest.cc b/src/librbd/image/CreateRequest.cc index 0e0d02bd9909..09aa17871a8d 100644 --- a/src/librbd/image/CreateRequest.cc +++ b/src/librbd/image/CreateRequest.cc @@ -387,11 +387,14 @@ Context *CreateRequest::handle_add_image_to_directory(int *result) { template void CreateRequest::create_image() { ldout(m_cct, 20) << this << " " << __func__ << dendl; + assert(m_data_pool.empty() || m_data_pool_id != -1); ostringstream oss; - oss << RBD_DATA_PREFIX << m_image_id; - - assert(m_data_pool.empty() || m_data_pool_id != -1); + oss << RBD_DATA_PREFIX; + if (m_data_pool_id != -1) { + oss << stringify(m_ioctx.get_id()) << "."; + } + oss << m_image_id; librados::ObjectWriteOperation op; op.create(true); -- 2.47.3