From: Yao Zongyou Date: Fri, 17 Nov 2017 05:47:23 +0000 (+0800) Subject: rgw-admin: check the data extra pool supports omap X-Git-Tag: v13.0.1~89^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7d31dd4c04166345e8f17fec98a44a8daf94a783;p=ceph.git 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 --- 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); }