summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOrit Wasserman <owasserm@redhat.com>2015-10-22 15:01:59 +0200
committerYehuda Sadeh <yehuda@redhat.com>2016-02-12 01:13:18 +0100
commitc16caa013a17ab7e00e1b4ef87aa3cc81098d2af (patch)
tree1a236b73d460eafae29c91e290cf9d5030f55068
parentradosgw-admin: fix zone get command (diff)
downloadceph-c16caa013a17ab7e00e1b4ef87aa3cc81098d2af.tar.xz
ceph-c16caa013a17ab7e00e1b4ef87aa3cc81098d2af.zip
rgw: update new name after converting region to zonegroup
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
-rw-r--r--src/rgw/rgw_rados.cc18
-rw-r--r--src/rgw/rgw_rados.h1
2 files changed, 14 insertions, 5 deletions
diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc
index 6fe8c8a0014..4bc57e3f4f4 100644
--- a/src/rgw/rgw_rados.cc
+++ b/src/rgw/rgw_rados.cc
@@ -1176,7 +1176,9 @@ const string& RGWZoneParams::get_predefined_name(CephContext *cct) {
int RGWZoneParams::init(CephContext *cct, RGWRados *store, bool setup_obj, bool old_format)
{
- name = cct->_conf->rgw_zone;
+ if (name.empty()) {
+ name = cct->_conf->rgw_zone;
+ }
int ret = RGWSystemMetaObj::init(cct, store, setup_obj, old_format);
if (ret < 0) {
@@ -2865,19 +2867,25 @@ int RGWRados::replace_region_with_zonegroup()
derr << "create zonegroup " << *iter << dendl;
/* read region info default has no data */
if (*iter != default_zonegroup_name){
- RGWZoneGroup zonegroup(*iter);
+ RGWZoneGroup zonegroup(*iter);
int ret = zonegroup.init(cct, this, true, true);
if (ret < 0) {
lderr(cct) << "failed init zonegroup: ret "<< ret << " " << cpp_strerror(-ret) << dendl;
return ret;
}
- derr << "create zonegroup: store_info " << *iter << dendl;
+ derr << "create zonegroup: name " << *iter << dendl;
ret = zonegroup.update();
if (ret < 0 && ret != -EEXIST) {
lderr(cct) << "failed to store zonegroup " << *iter << ": ret "<< ret << " " << cpp_strerror(-ret)
<< dendl;
return ret;
}
+ ret = zonegroup.update_name();
+ if (ret < 0 && ret != -EEXIST) {
+ lderr(cct) << "failed to store zonegroup " << *iter << ": ret "<< ret << " " << cpp_strerror(-ret)
+ << dendl;
+ return ret;
+ }
if (zonegroup.get_name() == default_region) {
ret = zonegroup.set_as_default();
if (ret < 0) {
@@ -2893,8 +2901,6 @@ int RGWRados::replace_region_with_zonegroup()
<< dendl;
return ret;
}
- lderr(cct) << "delete region " << *iter << ": ret "<< ret << " " << cpp_strerror(-ret)
- << dendl;
}
}
@@ -2977,6 +2983,8 @@ int RGWRados::init_complete()
lderr(cct) << "failed reading zonegroup info: ret "<< ret << " " << cpp_strerror(-ret) << dendl;
return ret;
} else if (ret == -ENOENT) {
+ derr << "zonegroup create_default " << dendl;
+
ret = zonegroup.create_default();
if (ret < 0) {
lderr(cct) << "failure in zonegroup create_default: ret "<< ret << " " << cpp_strerror(-ret)
diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h
index 30ce15f9df4..befdb2aabe5 100644
--- a/src/rgw/rgw_rados.h
+++ b/src/rgw/rgw_rados.h
@@ -791,6 +791,7 @@ public:
int delete_obj(bool old_format = false);
int rename(const string& new_name);
int update() { return store_info(false);}
+ int update_name() { return store_name(false);}
int read();
int write(bool exclusive);