From: lvshanchun Date: Tue, 21 Nov 2017 02:17:53 +0000 (+0800) Subject: rgw: fix the bug of radowgw-admin zonegroup set requires realm X-Git-Tag: v12.2.8~76^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=69f7acf8f03c054b05ee3f54fc7fc466e802083b;p=ceph.git rgw: fix the bug of radowgw-admin zonegroup set requires realm Signed-off-by: lvshanchun (cherry picked from commit 361be454ac2b917f777604f156711f752a6137f4) --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 350875984125..24e6365e58a9 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -3947,7 +3947,9 @@ int main(int argc, const char **argv) { RGWRealm realm(realm_id, realm_name); int ret = realm.init(g_ceph_context, store); - if (ret < 0) { + bool default_realm_not_exist = (ret == -ENOENT && realm_id.empty() && realm_name.empty()); + + if (ret < 0 && !default_realm_not_exist ) { cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl; return -ret; } @@ -3962,7 +3964,7 @@ int main(int argc, const char **argv) if (ret < 0) { return 1; } - if (zonegroup.realm_id.empty()) { + if (zonegroup.realm_id.empty() && !default_realm_not_exist) { zonegroup.realm_id = realm.get_id(); } ret = zonegroup.create();