From 7d31dd4c04166345e8f17fec98a44a8daf94a783 Mon Sep 17 00:00:00 2001 From: Yao Zongyou Date: Fri, 17 Nov 2017 13:47:23 +0800 Subject: [PATCH] rgw-admin: check the data extra pool supports omap If the data extra pool is ec and does not support omap, multi-part uploading will fail, so adding this check when adding or changing zone placement. Signed-off-by: Yao Zongyou --- src/rgw/rgw_admin.cc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 22fb0f0ce74e..abde1b832cae 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -2253,6 +2253,24 @@ static void parse_tier_config_param(const string& s, mapget_rados_handle()->ioctx_create(pool.to_str().c_str(), io_ctx); + if (ret < 0) { + // the pool may not exist at this moment, we have no way to check if it supports omap. + return 0; + } + + ret = io_ctx.omap_clear("__omap_test_not_exist_oid__"); + if (ret == -EOPNOTSUPP) { + io_ctx.close(); + return ret; + } + io_ctx.close(); + return 0; +} + int check_reshard_bucket_params(RGWRados *store, const string& bucket_name, const string& tenant, @@ -4294,6 +4312,13 @@ int main(int argc, const char **argv) if (compression_type) { info.compression_type = *compression_type; } + + ret = check_pool_support_omap(info.get_data_extra_pool()); + if (ret < 0) { + cerr << "ERROR: the data extra (non-ec) pool '" << info.get_data_extra_pool() + << "' does not support omap" << std::endl; + return ret; + } } else if (opt_cmd == OPT_ZONE_PLACEMENT_MODIFY) { auto p = zone.placement_pools.find(placement_id); if (p == zone.placement_pools.end()) { @@ -4317,6 +4342,13 @@ int main(int argc, const char **argv) if (compression_type) { info.compression_type = *compression_type; } + + ret = check_pool_support_omap(info.get_data_extra_pool()); + if (ret < 0) { + cerr << "ERROR: the data extra (non-ec) pool '" << info.get_data_extra_pool() + << "' does not support omap" << std::endl; + return ret; + } } else if (opt_cmd == OPT_ZONE_PLACEMENT_RM) { zone.placement_pools.erase(placement_id); } -- 2.47.3