From: Yehuda Sadeh Date: Tue, 9 Jan 2018 09:30:46 +0000 (-0800) Subject: rgw: sync module tier config fixes X-Git-Tag: v13.1.0~270^2~33 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e154b4b8cb9672fbdcfe6605b918d5974bd0f3af;p=ceph.git rgw: sync module tier config fixes Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 3b7439a1465..59b2145668c 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -2305,23 +2305,19 @@ static void parse_tier_config_param(const string& s, map confs; for (auto c : s) { - switch (c) { - case '{': - ++level; - break; - case '}': - --level; - break; - case ',': - if (level == 0) { - confs.push_back(cur_conf); - } - cur_conf.clear(); - break; - default: - cur_conf += c; - break; - }; + if (c == ',') { + if (level == 0) { + confs.push_back(cur_conf); + } + cur_conf.clear(); + continue; + } + if (c == '{') { + ++level; + } else if (c == '}') { + --level; + } + cur_conf += c; } if (!cur_conf.empty()) { confs.push_back(cur_conf); @@ -2330,7 +2326,7 @@ static void parse_tier_config_param(const string& s, map 0) { for (auto add : tier_config_add) { - zone.tier_config.set(add.first, add.second); + int r = zone.tier_config.set(add.first, add.second); + if (r < 0) { + cerr << "ERROR: failed to set configurable: " << add << std::endl; + return EINVAL; + } } need_zone_update = true; } - if (tier_config_rm.size() > 0) { - for (auto rm : tier_config_rm) { + for (auto rm : tier_config_rm) { + if (!rm.first.empty()) { /* otherwise will remove the entire config */ zone.tier_config.erase(rm.first); + need_zone_update = true; } - need_zone_update = true; } if (need_zone_update) {