mirror of
https://github.com/ceph/ceph
synced 2025-02-22 10:37:15 +00:00
Merge pull request #38653 from dillaman/wip-48647
librbd: clear implicitly enabled feature bits when creating images Reviewed-by: Mykola Golub <mgolub@suse.com>
This commit is contained in:
commit
1e880b195c
@ -549,7 +549,7 @@ int Image<I>::deep_copy(I *src, librados::IoCtx& dest_md_ctx,
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
features = (src->features & ~RBD_FEATURES_IMPLICIT_ENABLE);
|
||||
features = src->features;
|
||||
src_size = src->get_image_size(src->snap_id);
|
||||
}
|
||||
uint64_t format = 2;
|
||||
|
@ -467,8 +467,6 @@ int Migration<I>::prepare(librados::IoCtx& io_ctx,
|
||||
lderr(cct) << "librbd does not support requested features" << dendl;
|
||||
return -ENOSYS;
|
||||
}
|
||||
features &= ~RBD_FEATURES_IMPLICIT_ENABLE;
|
||||
features |= RBD_FEATURE_MIGRATING;
|
||||
opts.set(RBD_IMAGE_OPTION_FEATURES, features);
|
||||
|
||||
uint64_t order = src_image_ctx->order;
|
||||
@ -512,9 +510,6 @@ int Migration<I>::prepare(librados::IoCtx& io_ctx,
|
||||
opts, nullptr);
|
||||
r = migration.prepare();
|
||||
|
||||
features &= ~RBD_FEATURE_MIGRATING;
|
||||
opts.set(RBD_IMAGE_OPTION_FEATURES, features);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -560,10 +555,6 @@ int Migration<I>::prepare_import(
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
uint64_t features_set = 0;
|
||||
opts.get(RBD_IMAGE_OPTION_FEATURES_SET, &features_set);
|
||||
opts.set(RBD_IMAGE_OPTION_FEATURES_SET, features_set | RBD_FEATURE_MIGRATING);
|
||||
|
||||
ldout(cct, 20) << "updated opts=" << opts << dendl;
|
||||
|
||||
// use json-spirit to clean-up json formatting
|
||||
|
@ -216,7 +216,6 @@ void CloneRequest<I>::validate_parent() {
|
||||
if (m_use_p_features) {
|
||||
m_features = p_features;
|
||||
}
|
||||
m_features &= ~RBD_FEATURES_IMPLICIT_ENABLE;
|
||||
|
||||
if (r < 0) {
|
||||
lderr(m_cct) << "unable to locate parent's snapshot" << dendl;
|
||||
|
@ -40,7 +40,7 @@ int validate_features(CephContext *cct, uint64_t features) {
|
||||
lderr(cct) << "librbd does not support requested features." << dendl;
|
||||
return -ENOSYS;
|
||||
}
|
||||
if ((features & RBD_FEATURE_OPERATIONS) != 0) {
|
||||
if ((features & RBD_FEATURES_INTERNAL) != 0) {
|
||||
lderr(cct) << "cannot use internally controlled features" << dendl;
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -158,6 +158,7 @@ CreateRequest<I>::CreateRequest(const ConfigProxy& config, IoCtx &ioctx,
|
||||
m_features |= features_set;
|
||||
m_features &= ~features_clear;
|
||||
|
||||
m_features &= ~RBD_FEATURES_IMPLICIT_ENABLE;
|
||||
if ((m_features & RBD_FEATURE_OBJECT_MAP) == RBD_FEATURE_OBJECT_MAP) {
|
||||
m_features |= RBD_FEATURE_FAST_DIFF;
|
||||
}
|
||||
@ -203,14 +204,11 @@ CreateRequest<I>::CreateRequest(const ConfigProxy& config, IoCtx &ioctx,
|
||||
m_features |= RBD_FEATURE_DATA_POOL;
|
||||
} else {
|
||||
m_data_pool.clear();
|
||||
m_features &= ~RBD_FEATURE_DATA_POOL;
|
||||
}
|
||||
|
||||
if ((m_stripe_unit != 0 && m_stripe_unit != (1ULL << m_order)) ||
|
||||
(m_stripe_count != 0 && m_stripe_count != 1)) {
|
||||
m_features |= RBD_FEATURE_STRIPINGV2;
|
||||
} else {
|
||||
m_features &= ~RBD_FEATURE_STRIPINGV2;
|
||||
}
|
||||
|
||||
ldout(m_cct, 10) << "name=" << m_image_name << ", "
|
||||
|
@ -410,7 +410,6 @@ struct TestDeepCopy : public TestFixture {
|
||||
int order = m_src_ictx->order;
|
||||
uint64_t features;
|
||||
ASSERT_EQ(0, librbd::get_features(m_src_ictx, &features));
|
||||
features &= ~RBD_FEATURES_IMPLICIT_ENABLE;
|
||||
|
||||
std::cout << "clone " << m_src_ictx->name << " -> " << clone_name
|
||||
<< std::endl;
|
||||
|
@ -294,7 +294,6 @@ struct TestMigration : public TestFixture {
|
||||
int order = m_ref_ictx->order;
|
||||
uint64_t features;
|
||||
ASSERT_EQ(0, librbd::get_features(m_ref_ictx, &features));
|
||||
features &= ~RBD_FEATURES_IMPLICIT_ENABLE;
|
||||
|
||||
std::string ref_clone_name = get_temp_image_name();
|
||||
std::string clone_name = get_temp_image_name();
|
||||
@ -407,7 +406,6 @@ struct TestMigration : public TestFixture {
|
||||
int order = m_ictx->order;
|
||||
uint64_t features;
|
||||
ASSERT_EQ(0, librbd::get_features(m_ictx, &features));
|
||||
features &= ~RBD_FEATURES_IMPLICIT_ENABLE;
|
||||
|
||||
std::string clone_name = get_temp_image_name();
|
||||
ASSERT_EQ(0, librbd::clone(m_ictx->md_ctx, m_ictx->name.c_str(), "snap1",
|
||||
|
@ -73,8 +73,7 @@ public:
|
||||
|
||||
m_local_image_id = librbd::util::generate_image_id(m_local_io_ctx);
|
||||
librbd::ImageOptions image_opts;
|
||||
image_opts.set(RBD_IMAGE_OPTION_FEATURES,
|
||||
(RBD_FEATURES_ALL & ~RBD_FEATURES_IMPLICIT_ENABLE));
|
||||
image_opts.set(RBD_IMAGE_OPTION_FEATURES, RBD_FEATURES_ALL);
|
||||
EXPECT_EQ(0, librbd::create(m_local_io_ctx, m_image_name, m_local_image_id,
|
||||
1 << 20, image_opts, GLOBAL_IMAGE_ID,
|
||||
m_remote_mirror_uuid, true));
|
||||
|
@ -89,9 +89,7 @@ void TestFixture::TearDown() {
|
||||
int TestFixture::create_image(librbd::RBD &rbd, librados::IoCtx &ioctx,
|
||||
const std::string &name, uint64_t size) {
|
||||
int order = 18;
|
||||
return rbd.create2(ioctx, name.c_str(), size,
|
||||
(RBD_FEATURES_ALL & ~RBD_FEATURES_IMPLICIT_ENABLE),
|
||||
&order);
|
||||
return rbd.create2(ioctx, name.c_str(), size, RBD_FEATURES_ALL, &order);
|
||||
}
|
||||
|
||||
int TestFixture::open_image(librados::IoCtx &io_ctx,
|
||||
|
@ -404,8 +404,7 @@ template <typename I>
|
||||
void CreateImageRequest<I>::populate_image_options(
|
||||
librbd::ImageOptions* image_options) {
|
||||
image_options->set(RBD_IMAGE_OPTION_FEATURES,
|
||||
(m_remote_image_ctx->features &
|
||||
~RBD_FEATURES_IMPLICIT_ENABLE));
|
||||
m_remote_image_ctx->features);
|
||||
image_options->set(RBD_IMAGE_OPTION_ORDER, m_remote_image_ctx->order);
|
||||
image_options->set(RBD_IMAGE_OPTION_STRIPE_UNIT,
|
||||
m_remote_image_ctx->stripe_unit);
|
||||
|
Loading…
Reference in New Issue
Block a user