mirror of
https://github.com/ceph/ceph
synced 2025-03-30 15:31:01 +00:00
Merge pull request #11641 from vshankar/rbd-data-pool-assert
librbd: possible assert failure creating image when using data pool Reviewed-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
commit
fdea4404a4
@ -190,6 +190,7 @@ CreateRequest<I>::CreateRequest(IoCtx &ioctx, const std::string &image_name,
|
||||
if (!m_data_pool.empty() && m_data_pool != ioctx.get_pool_name()) {
|
||||
m_features |= RBD_FEATURE_DATA_POOL;
|
||||
} else {
|
||||
m_data_pool.clear();
|
||||
m_features &= ~RBD_FEATURE_DATA_POOL;
|
||||
}
|
||||
|
||||
|
@ -254,6 +254,43 @@ TEST_F(TestLibRBD, CreateAndStat)
|
||||
rados_ioctx_destroy(ioctx);
|
||||
}
|
||||
|
||||
TEST_F(TestLibRBD, CreateWithSameDataPool)
|
||||
{
|
||||
REQUIRE_FORMAT_V2();
|
||||
|
||||
rados_ioctx_t ioctx;
|
||||
ASSERT_EQ(0, rados_ioctx_create(_cluster, m_pool_name.c_str(), &ioctx));
|
||||
|
||||
rbd_image_t image;
|
||||
std::string name = get_temp_image_name();
|
||||
uint64_t size = 2 << 20;
|
||||
|
||||
bool old_format;
|
||||
uint64_t features;
|
||||
ASSERT_EQ(0, get_features(&old_format, &features));
|
||||
ASSERT_FALSE(old_format);
|
||||
|
||||
rbd_image_options_t image_options;
|
||||
rbd_image_options_create(&image_options);
|
||||
BOOST_SCOPE_EXIT( (&image_options) ) {
|
||||
rbd_image_options_destroy(image_options);
|
||||
} BOOST_SCOPE_EXIT_END;
|
||||
|
||||
ASSERT_EQ(0, rbd_image_options_set_uint64(image_options,
|
||||
RBD_IMAGE_OPTION_FEATURES,
|
||||
features));
|
||||
ASSERT_EQ(0, rbd_image_options_set_string(image_options,
|
||||
RBD_IMAGE_OPTION_DATA_POOL,
|
||||
m_pool_name.c_str()));
|
||||
|
||||
ASSERT_EQ(0, rbd_create4(ioctx, name.c_str(), size, image_options));
|
||||
ASSERT_EQ(0, rbd_open(ioctx, name.c_str(), &image, NULL));
|
||||
|
||||
ASSERT_EQ(0, rbd_close(image));
|
||||
|
||||
rados_ioctx_destroy(ioctx);
|
||||
}
|
||||
|
||||
TEST_F(TestLibRBD, CreateAndStatPP)
|
||||
{
|
||||
librados::IoCtx ioctx;
|
||||
|
Loading…
Reference in New Issue
Block a user